mtpfws/mtpfw/src/cmtpdataprovidercontroller.cpp
changeset 49 c20dd21d1eb4
parent 31 a26669f87b46
child 54 4dc88a4ac6f4
child 60 841f70763fbe
equal deleted inserted replaced
41:2c19c7cf5550 49:c20dd21d1eb4
    25 #include "cmtpdataprovidercontroller.h"
    25 #include "cmtpdataprovidercontroller.h"
    26 #include "cmtpobjectmgr.h"
    26 #include "cmtpobjectmgr.h"
    27 #include "mtpframeworkconst.h"
    27 #include "mtpframeworkconst.h"
    28 #include "cmtpframeworkconfig.h"
    28 #include "cmtpframeworkconfig.h"
    29 #include "cmtpstoragemgr.h"
    29 #include "cmtpstoragemgr.h"
       
    30 #include "mtpdebug.h"
       
    31 #include "OstTraceDefinitions.h"
       
    32 #ifdef OST_TRACE_COMPILER_IN_USE
       
    33 #include "cmtpdataprovidercontrollerTraces.h"
       
    34 #endif
       
    35 
    30 
    36 
    31 
    37 
    32 // Class constants.
    38 // Class constants.
    33 _LIT(KMTPDpResourceDirectory, "z:\\resource\\mtp\\");
    39 _LIT(KMTPDpResourceDirectory, "z:\\resource\\mtp\\");
    34 _LIT(KMTPDpDummyResourcefile, "z:\\resource\\mtp\\dummydp.rsc");
    40 _LIT(KMTPDpDummyResourcefile, "z:\\resource\\mtp\\dummydp.rsc");
    35 
       
    36 // Class constants.
       
    37 __FLOG_STMT(_LIT8(KComponent,"DataProviderController");)
       
    38 
    41 
    39 static const TUint KOpaqueDataLength(64);
    42 static const TUint KOpaqueDataLength(64);
    40 
    43 
    41 /**
    44 /**
    42 CMTPDataProviderController panics
    45 CMTPDataProviderController panics
    73 /**
    76 /**
    74 Destructor.
    77 Destructor.
    75 */
    78 */
    76 CMTPDataProviderController::~CMTPDataProviderController()
    79 CMTPDataProviderController::~CMTPDataProviderController()
    77     {
    80     {
    78     __FLOG(_L8("~CMTPDataProviderController - Entry"));
    81     OstTraceFunctionEntry0( CMTPDATAPROVIDERCONTROLLER_CMTPDATAPROVIDERCONTROLLER_DES_ENTRY );
       
    82     
    79     Cancel();
    83     Cancel();
    80     UnloadDataProviders();
    84     UnloadDataProviders();
    81     iDataProviderIds.Close();
    85     iDataProviderIds.Close();
    82     iEnumeratingDps.Close();
    86     iEnumeratingDps.Close();
    83     iEnumeratingStorages.Close();
    87     iEnumeratingStorages.Close();
    84     iSingletons.Close();
    88     iSingletons.Close();
    85     CloseRegistrySessionAndEntryL();
    89     CloseRegistrySessionAndEntryL();
    86     delete iOpenSessionWaiter;
    90     delete iOpenSessionWaiter;
    87     delete iPendingRequestTimer;
    91     delete iPendingRequestTimer;
    88     __FLOG(_L8("~CMTPDataProviderController - Exit"));
    92     
    89     __FLOG_CLOSE;
    93     OstTraceFunctionExit0( CMTPDATAPROVIDERCONTROLLER_CMTPDATAPROVIDERCONTROLLER_DES_EXIT );
    90     }
    94     }
    91     
    95     
    92 /**
    96 /**
    93 Loads the set of available data providers and initiates the data provider
    97 Loads the set of available data providers and initiates the data provider
    94 enumeration sequence.
    98 enumeration sequence.
    95 @leave One of the system wide error codes, if a processing failure occurs.
    99 @leave One of the system wide error codes, if a processing failure occurs.
    96 */
   100 */
    97 EXPORT_C void CMTPDataProviderController::LoadDataProvidersL()
   101 EXPORT_C void CMTPDataProviderController::LoadDataProvidersL()
    98     {
   102     {
    99     __FLOG(_L8("LoadDataProvidersL - Entry"));
   103     OstTraceFunctionEntry0( CMTPDATAPROVIDERCONTROLLER_LOADDATAPROVIDERSL_ENTRY );
       
   104 
   100     // Retrieve the ECOM data provider implementations list
   105     // Retrieve the ECOM data provider implementations list
   101     RImplInfoPtrArray   implementations;
   106     RImplInfoPtrArray   implementations;
   102     TCleanupItem        cleanup(ImplementationsCleanup, reinterpret_cast<TAny*>(&implementations));
   107     TCleanupItem        cleanup(ImplementationsCleanup, reinterpret_cast<TAny*>(&implementations));
   103     CleanupStack::PushL(cleanup);
   108     CleanupStack::PushL(cleanup);
   104     REComSession::ListImplementationsL(KMTPDataProviderPluginInterfaceUid, implementations);
   109     REComSession::ListImplementationsL(KMTPDataProviderPluginInterfaceUid, implementations);
   105     implementations.Sort(TLinearOrder<CImplementationInformation>(ImplementationsLinearOrderUid));
   110     implementations.Sort(TLinearOrder<CImplementationInformation>(ImplementationsLinearOrderUid));
   106     
   111     
   107     // Retrieve the data provider registration resource file list.
   112     // Retrieve the data provider registration resource file list.
   108     CDir* registrations;
   113     CDir* registrations;
   109     User::LeaveIfError(iSingletons.Fs().GetDir(KMTPDpResourceDirectory, KEntryAttNormal, ESortByName, registrations));
   114     LEAVEIFERROR(iSingletons.Fs().GetDir(KMTPDpResourceDirectory, KEntryAttNormal, ESortByName, registrations),
       
   115             OstTrace0( TRACE_ERROR, DUP5_CMTPDATAPROVIDERCONTROLLER_LOADDATAPROVIDERSL, "get MTP Dp resource directory error!" ));
       
   116             
   110     CleanupStack::PushL(registrations);
   117     CleanupStack::PushL(registrations);
   111 
   118 
   112     CreateRegistrySessionAndEntryL();
   119     CreateRegistrySessionAndEntryL();
   113     
   120     
   114     // Load the registered data providers. 
   121     // Load the registered data providers. 
   117     for (TInt i = 0; i < KCount; ++i)
   124     for (TInt i = 0; i < KCount; ++i)
   118         {
   125         {
   119         TUint uid = 0;
   126         TUint uid = 0;
   120         if(Uid((*registrations)[i].iName, uid) != KErrNone)
   127         if(Uid((*registrations)[i].iName, uid) != KErrNone)
   121         	{
   128         	{
   122         	__FLOG_1(_L8("LoadDataProvidersL - Fail to get UID = %s"),&((*registrations)[i].iName) );
   129         	OstTraceExt1( TRACE_WARNING, CMTPDATAPROVIDERCONTROLLER_LOADDATAPROVIDERSL, 
       
   130         	        "LoadDataProvidersL - Fail to get UID = %S", (*registrations)[i].iName);       	
   123         	continue;
   131         	continue;
   124         	}
   132         	}
   125         index = implementations.FindInOrder(TUid::Uid(uid), ImplementationsLinearOrderUid);
   133         index = implementations.FindInOrder(TUid::Uid(uid), ImplementationsLinearOrderUid);
   126         if (KErrNotFound == index)
   134         if (KErrNotFound == index)
   127         	{
   135         	{
   163     for (index = 0; index < implementations.Count(); ++index)
   171     for (index = 0; index < implementations.Count(); ++index)
   164         {
   172         {
   165         TRAPD(err, LoadInstalledDataProvidersL(implementations[index]));
   173         TRAPD(err, LoadInstalledDataProvidersL(implementations[index]));
   166         if (KErrNone != err)
   174         if (KErrNone != err)
   167             {
   175             {
   168             __FLOG_VA((_L8("Load installed data provider[0x%x] failed."),implementations[index]->ImplementationUid().iUid));
   176             OstTrace1(TRACE_ERROR, DUP1_CMTPDATAPROVIDERCONTROLLER_LOADDATAPROVIDERSL, 
       
   177                     "Load installed data provider[0x%x] failed.", implementations[index]->ImplementationUid().iUid);
   169             }
   178             }
   170         }
   179         }
   171 
   180 
   172     CleanupStack::PopAndDestroy(registrations);
   181     CleanupStack::PopAndDestroy(registrations);
   173     CleanupStack::PopAndDestroy(&implementations);    
   182     CleanupStack::PopAndDestroy(&implementations);    
   174 
   183 
   175     // Verify that the framework data providers are loaded.
   184     // Verify that the framework data providers are loaded.
   176     User::LeaveIfError(DpId(KMTPImplementationUidDeviceDp));
   185     LEAVEIFERROR(DpId(KMTPImplementationUidDeviceDp),
   177     User::LeaveIfError(DpId(KMTPImplementationUidProxyDp));
   186             OstTrace0( TRACE_ERROR, DUP2_CMTPDATAPROVIDERCONTROLLER_LOADDATAPROVIDERSL, "Device Dp not loaded!" ));           
   178     User::LeaveIfError(DpId(KMTPImplementationUidFileDp));
   187     LEAVEIFERROR(DpId(KMTPImplementationUidProxyDp),
   179 
   188             OstTrace0( TRACE_ERROR, DUP3_CMTPDATAPROVIDERCONTROLLER_LOADDATAPROVIDERSL, "Proxy Dp not loaded!" ));       
       
   189     LEAVEIFERROR(DpId(KMTPImplementationUidFileDp),
       
   190             OstTrace0( TRACE_ERROR, DUP4_CMTPDATAPROVIDERCONTROLLER_LOADDATAPROVIDERSL, "file Dp not loaded!" ));
       
   191             
   180 	// Sort the data provider set on enumeration phase order.
   192 	// Sort the data provider set on enumeration phase order.
   181 	iDataProviders.Sort(TLinearOrder<CMTPDataProvider>(CMTPDataProvider::LinearOrderEnumerationPhase));
   193 	iDataProviders.Sort(TLinearOrder<CMTPDataProvider>(CMTPDataProvider::LinearOrderEnumerationPhase));
   182 	// Add the DP IDs into DP ID array, except for device DP, File DP and proxy DP
   194 	// Add the DP IDs into DP ID array, except for device DP, File DP and proxy DP
   183 	for (TUint index=0; index < iDataProviders.Count(); index++)
   195 	for (TUint index=0; index < iDataProviders.Count(); index++)
   184 	  {
   196 	  {
   194     
   206     
   195     // Start enumerating.
   207     // Start enumerating.
   196     iEnumeratingStorages.AppendL(KMTPStorageAll);
   208     iEnumeratingStorages.AppendL(KMTPStorageAll);
   197     iEnumerationState = EEnumerationStarting;
   209     iEnumerationState = EEnumerationStarting;
   198     Schedule();
   210     Schedule();
   199     __FLOG(_L8("LoadDataProvidersL - Exit"));
   211     OstTraceFunctionExit0( CMTPDATAPROVIDERCONTROLLER_LOADDATAPROVIDERSL_EXIT );
   200     }
   212     }
   201     
   213     
   202 /**
   214 /**
   203 Unloads all active data providers.
   215 Unloads all active data providers.
   204 @leave One of the system wide error codes, if a processing failure occurs.
   216 @leave One of the system wide error codes, if a processing failure occurs.
   205 */
   217 */
   206 EXPORT_C void CMTPDataProviderController::UnloadDataProviders()
   218 EXPORT_C void CMTPDataProviderController::UnloadDataProviders()
   207     {
   219     {
   208     __FLOG(_L8("UnloadDataProviders - Entry"));
   220     OstTraceFunctionEntry0( CMTPDATAPROVIDERCONTROLLER_UNLOADDATAPROVIDERS_ENTRY );
   209     TRAP_IGNORE(iSingletons.ObjectMgr().ObjectStore().CleanL());
   221     TRAP_IGNORE(iSingletons.ObjectMgr().ObjectStore().CleanL());
   210     iDataProviders.ResetAndDestroy();
   222     iDataProviders.ResetAndDestroy();
   211     iDataProviderIds.Reset();
   223     iDataProviderIds.Reset();
   212     __FLOG(_L8("UnloadDataProviders - Exit"));
   224     OstTraceFunctionExit0( CMTPDATAPROVIDERCONTROLLER_UNLOADDATAPROVIDERS_EXIT );
   213     }
   225     }
   214     
   226     
   215 /**
   227 /**
   216 Issues the specified notification to all loaded data providers.
   228 Issues the specified notification to all loaded data providers.
   217 @param aNotification The notification type identifier.
   229 @param aNotification The notification type identifier.
   224     NotifyDataProvidersL(KMTPDataProviderAll, aNotification, aParams);
   236     NotifyDataProvidersL(KMTPDataProviderAll, aNotification, aParams);
   225     }
   237     }
   226 
   238 
   227 EXPORT_C void CMTPDataProviderController::NotifyDataProvidersL(TUint aDPId, TMTPNotification aNotification, const TAny* aParams)
   239 EXPORT_C void CMTPDataProviderController::NotifyDataProvidersL(TUint aDPId, TMTPNotification aNotification, const TAny* aParams)
   228     {
   240     {
   229     __FLOG(_L8("NotifyDataProvidersL - Entry"));
   241     OstTraceFunctionEntry0( CMTPDATAPROVIDERCONTROLLER_NOTIFYDATAPROVIDERSL_ENTRY);
   230     // Schedule any long running operations.
   242     // Schedule any long running operations.
   231     switch (aNotification)
   243     switch (aNotification)
   232         {
   244         {
   233     case EMTPStorageAdded:
   245     case EMTPStorageAdded:
   234         {
   246         {
   258         for(TInt i=1; i<iEnumeratingStorages.Count(); i++)
   270         for(TInt i=1; i<iEnumeratingStorages.Count(); i++)
   259             {
   271             {
   260             if(storageId==iEnumeratingStorages[i])
   272             if(storageId==iEnumeratingStorages[i])
   261                 {
   273                 {
   262                 iEnumeratingStorages.Remove(i);
   274                 iEnumeratingStorages.Remove(i);
   263                 __FLOG_VA((_L8("Unhandle memory card add event removed, storageId: %d"), storageId));
   275                 OstTrace1(TRACE_ERROR, CMTPDATAPROVIDERCONTROLLER_NOTIFYDATAPROVIDERSL, 
       
   276                         "Unhandle memory card add event removed, storageId: %d", storageId);
   264                 }
   277                 }
   265             }
   278             }
   266         }
   279         }
   267         break;
   280         break;
   268     case EMTPObjectAdded:
   281     case EMTPObjectAdded:
   302                 dp->Plugin().ProcessNotificationL(aNotification, aParams);
   315                 dp->Plugin().ProcessNotificationL(aNotification, aParams);
   303                 break;
   316                 break;
   304                 }
   317                 }
   305             }
   318             }
   306         }    
   319         }    
   307     __FLOG(_L8("NotifyDataProvidersL - Exit"));
   320     OstTraceFunctionExit0( CMTPDATAPROVIDERCONTROLLER_NOTIFYDATAPROVIDERSL_EXIT);
   308     }
   321     }
   309 
   322 
   310 /**
   323 /**
   311 Provides the number of active data providers.
   324 Provides the number of active data providers.
   312 @return the number of active data providers.
   325 @return the number of active data providers.
   422 Data provider enumeration state change notification callback.
   435 Data provider enumeration state change notification callback.
   423 @param aDp The notifying data provider.
   436 @param aDp The notifying data provider.
   424 */    
   437 */    
   425 void CMTPDataProviderController::EnumerationStateChangedL(const CMTPDataProvider& aDp)
   438 void CMTPDataProviderController::EnumerationStateChangedL(const CMTPDataProvider& aDp)
   426     {
   439     {
   427     __FLOG(_L8("EnumerationStateChangedL - Entry"));
   440     OstTraceFunctionEntry0( CMTPDATAPROVIDERCONTROLLER_ENUMERATIONSTATECHANGEDL_ENTRY);
   428     __FLOG_VA((_L8("Entry iEnumerationState: 0x%x DpId: %d"), iEnumerationState, aDp.DataProviderId()));
   441     OstTraceDefExt2(OST_TRACE_CATEGORY_PRODUCTION, TRACE_IMPORTANT, CMTPDATAPROVIDERCONTROLLER_ENUMERATIONSTATECHANGEDL, 
       
   442             "iEnumerationState: 0x%x DpId: %d", iEnumerationState, aDp.DataProviderId());
   429     switch (iEnumerationState)
   443     switch (iEnumerationState)
   430         {        
   444         {        
   431     case EEnumeratingFrameworkStorages:
   445     case EEnumeratingFrameworkStorages:
   432     	switch (aDp.ImplementationUid().iUid)
   446     	switch (aDp.ImplementationUid().iUid)
   433             {
   447             {
   478         
   492         
   479     case EEnumeratingDataProviderObjects:
   493     case EEnumeratingDataProviderObjects:
   480     case EEnumeratingSubDirFiles:
   494     case EEnumeratingSubDirFiles:
   481         if(KMTPImplementationUidFileDp == aDp.ImplementationUid().iUid && NeedEnumeratingPhase2())
   495         if(KMTPImplementationUidFileDp == aDp.ImplementationUid().iUid && NeedEnumeratingPhase2())
   482             {
   496             {
   483             __FLOG(_L8("File DP first level enum complete"));
   497             OstTrace0(TRACE_NORMAL, DUP1_CMTPDATAPROVIDERCONTROLLER_ENUMERATIONSTATECHANGEDL,
       
   498                     "File DP first level enum complete");
   484             Cancel();
   499             Cancel();
   485 
   500 
   486             //clean the root level snapshot
   501             //clean the root level snapshot
   487             TRAP_IGNORE(iSingletons.ObjectMgr().ObjectStore().CleanDBSnapshotL(ETrue));
   502             TRAP_IGNORE(iSingletons.ObjectMgr().ObjectStore().CleanDBSnapshotL(ETrue));
   488 
   503 
   521     default:
   536     default:
   522         __DEBUG_ONLY(User::Invariant());
   537         __DEBUG_ONLY(User::Invariant());
   523         break;
   538         break;
   524         }
   539         }
   525     
   540     
   526     __FLOG_VA((_L8("Exit iEnumerationState: 0x%x, DpId: %d, UID=0x%x"), iEnumerationState,  aDp.DataProviderId(), aDp.ImplementationUid().iUid));
   541     OstTraceExt3(TRACE_NORMAL, DUP2_CMTPDATAPROVIDERCONTROLLER_ENUMERATIONSTATECHANGEDL, 
   527     __FLOG(_L8("EnumerationStateChangedL - Exit"));
   542                 "iEnumerationState: 0x%x, DpId: %d, UID=0x%x", iEnumerationState, aDp.DataProviderId(), (TUint)aDp.ImplementationUid().iUid);
       
   543     OstTraceFunctionExit0( CMTPDATAPROVIDERCONTROLLER_ENUMERATIONSTATECHANGEDL_EXIT);
   528     }
   544     }
   529 
   545 
   530 void CMTPDataProviderController::DoCancel()
   546 void CMTPDataProviderController::DoCancel()
   531     {
   547     {
   532     __FLOG(_L8("DoCancel - Entry"));
   548     OstTraceFunctionEntry0( CMTPDATAPROVIDERCONTROLLER_DOCANCEL_ENTRY);
   533     __FLOG(_L8("DoCancel - Exit"));
   549     OstTraceFunctionExit0( CMTPDATAPROVIDERCONTROLLER_DOCANCEL_EXIT);
   534     }
   550     }
   535     
   551     
   536 
   552 
   537 
   553 
   538 /*
   554 /*
   551             {
   567             {
   552             const RArray<TUint>& logicalIds(storage.UintArray(CMTPStorageMetaData::EStorageLogicalIds));
   568             const RArray<TUint>& logicalIds(storage.UintArray(CMTPStorageMetaData::EStorageLogicalIds));
   553             const TUint KCountLogicalIds(logicalIds.Count());
   569             const TUint KCountLogicalIds(logicalIds.Count());
   554             for (TUint i(0); (i < KCountLogicalIds); i++)
   570             for (TUint i(0); (i < KCountLogicalIds); i++)
   555                 {
   571                 {
   556                 __FLOG_VA((_L8("Establish snapshot for storage: 0x%x"), logicalIds[i]));
   572                 OstTrace1(TRACE_NORMAL, CMTPDATAPROVIDERCONTROLLER_ESTABLISHDBSNAPSHOTL,
       
   573                         "Establish snapshot for storage: 0x%x", logicalIds[i]);
   557                 iSingletons.ObjectMgr().ObjectStore().EstablishDBSnapshotL(logicalIds[i]);
   574                 iSingletons.ObjectMgr().ObjectStore().EstablishDBSnapshotL(logicalIds[i]);
   558                 }   
   575                 }   
   559             }
   576             }
   560         }
   577         }
   561     }
   578     }
   562 
   579 
   563 
   580 
   564 void CMTPDataProviderController::RunL()
   581 void CMTPDataProviderController::RunL()
   565     {
   582     {
   566     __FLOG(_L8("RunL - Entry"));
   583     OstTraceFunctionEntry0( CMTPDATAPROVIDERCONTROLLER_RUNL_ENTRY );
   567     __FLOG_VA((_L8("iEnumerationState: 0x%x iNextDpId: %d"), iEnumerationState, iNextDpId));
   584     OstTraceDef1(OST_TRACE_CATEGORY_PRODUCTION, TRACE_IMPORTANT, CMTPDATAPROVIDERCONTROLLER_RUNL, 
       
   585             "iEnumerationState: 0x%x", iEnumerationState);
   568     switch (iEnumerationState)
   586     switch (iEnumerationState)
   569         {
   587         {
   570     case EEnumerationStarting:
   588     case EEnumerationStarting:
   571         iEnumerationState   = EEnumeratingFrameworkStorages;
   589         iEnumerationState   = EEnumeratingFrameworkStorages;
   572         iNextDpId           = iDpIdDeviceDp;
   590         iNextDpId           = iDpIdDeviceDp;
   649         const TUint KLoadedDps(iDataProviderIds.Count());
   667         const TUint KLoadedDps(iDataProviderIds.Count());
   650         while ((iEnumeratingDps.Count() < KMTPMaxEnumeratingDataProviders) && (iDpIdArrayIndex < KLoadedDps)
   668         while ((iEnumeratingDps.Count() < KMTPMaxEnumeratingDataProviders) && (iDpIdArrayIndex < KLoadedDps)
   651                && (iEnumerationPhase == DataProviderL(iDataProviderIds[iDpIdArrayIndex]).DataProviderConfig().UintValue(MMTPDataProviderConfig::EEnumerationPhase)))
   669                && (iEnumerationPhase == DataProviderL(iDataProviderIds[iDpIdArrayIndex]).DataProviderConfig().UintValue(MMTPDataProviderConfig::EEnumerationPhase)))
   652             {
   670             {
   653             currentDp = iDataProviderIds[iDpIdArrayIndex++];
   671             currentDp = iDataProviderIds[iDpIdArrayIndex++];
   654             __FLOG_VA((_L8("Enumerating dpid %d"), currentDp));
   672             OstTrace1(TRACE_NORMAL, DUP1_CMTPDATAPROVIDERCONTROLLER_RUNL, 
       
   673                     "Enumerating dpid %d", currentDp);
   655             iEnumeratingDps.InsertInOrderL(currentDp);
   674             iEnumeratingDps.InsertInOrderL(currentDp);
   656             EnumerateDataProviderObjectsL(currentDp);
   675             EnumerateDataProviderObjectsL(currentDp);
   657             }
   676             }
   658         
   677         
   659         __FLOG_VA((_L8("iDpIdArrayIndex = %d, KLoadedDps = %d"), iDpIdArrayIndex, KLoadedDps));
   678         OstTraceExt2(TRACE_NORMAL, DUP2_CMTPDATAPROVIDERCONTROLLER_RUNL, 
       
   679                 "iDpIdArrayIndex = %d, KLoadedDps = %d", iDpIdArrayIndex, KLoadedDps);
   660         }
   680         }
   661         break;
   681         break;
   662         
   682         
   663     case EEnumeratingCleanDBSnapshot:
   683     case EEnumeratingCleanDBSnapshot:
   664         {
   684         {
   688     case EEnumeratingPhaseOneDone:
   708     case EEnumeratingPhaseOneDone:
   689     default:
   709     default:
   690         __DEBUG_ONLY(User::Invariant());
   710         __DEBUG_ONLY(User::Invariant());
   691         break;
   711         break;
   692         }
   712         }
   693     __FLOG(_L8("RunL - Exit"));
   713     OstTraceFunctionExit0( CMTPDATAPROVIDERCONTROLLER_RUNL_EXIT );
   694     }
   714     }
   695 
   715 
   696 #ifdef __FLOG_ACTIVE
   716 
   697 TInt CMTPDataProviderController::RunError(TInt aError)
   717 TInt CMTPDataProviderController::RunError(TInt aError)
   698 #else
   718     {
   699 TInt CMTPDataProviderController::RunError(TInt /*aError*/)
   719     OstTraceFunctionEntry0( CMTPDATAPROVIDERCONTROLLER_RUNERROR_ENTRY );
   700 #endif
   720     OstTrace1(TRACE_NORMAL, CMTPDATAPROVIDERCONTROLLER_RUNERROR, "Error = %d", aError);
   701     {
       
   702     __FLOG(_L8("RunError - Entry"));
       
   703     __FLOG_VA((_L8("Error = %d"), aError));
       
   704     
   721     
   705     // If a RunL error happens, there's no point in trying to continue.
   722     // If a RunL error happens, there's no point in trying to continue.
   706     switch (iEnumerationState)
   723     switch (iEnumerationState)
   707         {
   724         {
   708     case EEnumerationStarting:
   725     case EEnumerationStarting:
   728         User::Invariant();
   745         User::Invariant();
   729         break;
   746         break;
   730         }
   747         }
   731 
   748 
   732     // This code is never reached
   749     // This code is never reached
   733     __FLOG(_L8("RunError - Exit"));
   750     OstTraceFunctionExit0( CMTPDATAPROVIDERCONTROLLER_RUNERROR_EXIT );
   734     return KErrNone;
   751     return KErrNone;
   735     }
   752     }
   736 
   753 
   737 /**
   754 /**
   738 Constructor.
   755 Constructor.
   747 Second-phase constructor.
   764 Second-phase constructor.
   748 @leave One of the system wide error codes if a processing failure occurs.
   765 @leave One of the system wide error codes if a processing failure occurs.
   749 */
   766 */
   750 void CMTPDataProviderController::ConstructL()
   767 void CMTPDataProviderController::ConstructL()
   751     {
   768     {
   752     __FLOG_OPEN(KMTPSubsystem, KComponent);
   769     OstTraceFunctionEntry0( CMTPDATAPROVIDERCONTROLLER_CONSTRUCTL_ENTRY );
   753     __FLOG(_L8("ConstructL - Entry"));
       
   754     iSingletons.OpenL();
   770     iSingletons.OpenL();
   755 	TInt tMTPMode;
   771 	TInt tMTPMode;
   756 	TInt err = RProperty::Get(KUidSystemCategory, KUidMTPModeKeyValue, tMTPMode);
   772 	TInt err = RProperty::Get(KUidSystemCategory, KUidMTPModeKeyValue, tMTPMode);
   757 	if(err != KErrNone)
   773 	if(err != KErrNone)
   758 		{
   774 		{
   770 	
   786 	
   771     iOpenSessionWaiter = new(ELeave) CActiveSchedulerWait();
   787     iOpenSessionWaiter = new(ELeave) CActiveSchedulerWait();
   772     
   788     
   773     iPendingRequestTimer = CMTPPendingReqestTimer::NewL(this);
   789     iPendingRequestTimer = CMTPPendingReqestTimer::NewL(this);
   774     
   790     
   775     __FLOG(_L8("ConstructL - Exit"));
   791     OstTraceFunctionExit0( CMTPDATAPROVIDERCONTROLLER_CONSTRUCTL_EXIT );
   776     }
   792     }
   777     
   793     
   778 /**
   794 /**
   779 Creates a data provider configurability parameter data instance on the cleanup 
   795 Creates a data provider configurability parameter data instance on the cleanup 
   780 stack.
   796 stack.
   783 which is also placed on the cleanup stack. Ownership is transferred.
   799 which is also placed on the cleanup stack. Ownership is transferred.
   784 @leave One of the system wide error codes, if a processing failure occurs.
   800 @leave One of the system wide error codes, if a processing failure occurs.
   785 */    
   801 */    
   786 CMTPDataProviderConfig* CMTPDataProviderController::CreateConfigLC(const TDesC& aResourceFilename)
   802 CMTPDataProviderConfig* CMTPDataProviderController::CreateConfigLC(const TDesC& aResourceFilename)
   787     {
   803     {
   788     __FLOG(_L8("CreateConfigLC - Entry"));
   804     OstTraceFunctionEntry0( CMTPDATAPROVIDERCONTROLLER_CREATECONFIGLC_ENTRY );
       
   805 
   789     // Open the configuration data resource file
   806     // Open the configuration data resource file
   790     RResourceFile file;
   807     RResourceFile file;
   791     CleanupClosePushL(file);
   808     CleanupClosePushL(file);
   792     file.OpenL(iSingletons.Fs(), aResourceFilename);    
   809     file.OpenL(iSingletons.Fs(), aResourceFilename);    
   793     
   810     
   800     // Load the data provider configurability parameter data.
   817     // Load the data provider configurability parameter data.
   801     CMTPDataProviderConfig* config(CMTPDataProviderConfig::NewL(reader, aResourceFilename));
   818     CMTPDataProviderConfig* config(CMTPDataProviderConfig::NewL(reader, aResourceFilename));
   802     CleanupStack::PopAndDestroy(buffer);
   819     CleanupStack::PopAndDestroy(buffer);
   803     CleanupStack::PopAndDestroy(&file);
   820     CleanupStack::PopAndDestroy(&file);
   804     CleanupStack::PushL(config);
   821     CleanupStack::PushL(config);
   805     __FLOG(_L8("CreateConfigLC - Exit"));
   822     OstTraceFunctionExit0( CMTPDATAPROVIDERCONTROLLER_CREATECONFIGLC_EXIT );
   806     return config;
   823     return config;
   807     }
   824     }
   808 
   825 
   809 /**
   826 /**
   810 Check the  necessity of objects enumeration as given the data provider 
   827 Check the  necessity of objects enumeration as given the data provider 
   811 @param dp CMTPDataProvider reference
   828 @param dp CMTPDataProvider reference
   812 */
   829 */
   813 TBool CMTPDataProviderController::IsObjectsEnumerationNeededL(CMTPDataProvider& dp)
   830 TBool CMTPDataProviderController::IsObjectsEnumerationNeededL(CMTPDataProvider& dp)
   814 {
   831 {
   815     __FLOG(_L8("CheckEnumerateDPObjectsL - Entry"));
   832     OstTraceFunctionEntry0( CMTPDATAPROVIDERCONTROLLER_ISOBJECTSENUMERATIONNEEDEDL_ENTRY );
   816 
   833 
   817 	CMTPStorageMgr& storages = iSingletons.StorageMgr();
   834 	CMTPStorageMgr& storages = iSingletons.StorageMgr();
   818 	TUint32 aStorageId = iEnumeratingStorages[0];
   835 	TUint32 aStorageId = iEnumeratingStorages[0];
   819 	
   836 	
   820     TBool doEnumeration = true;
   837     TBool doEnumeration = true;
   832 		if (!isFSBased)
   849 		if (!isFSBased)
   833 			{
   850 			{
   834 			  doEnumeration = false;
   851 			  doEnumeration = false;
   835 			}
   852 			}
   836 	    }
   853 	    }
   837 	__FLOG(_L8("CheckEnumerateDPObjectsL - Exit"));
   854 	OstTraceFunctionExit0( CMTPDATAPROVIDERCONTROLLER_ISOBJECTSENUMERATIONNEEDEDL_EXIT );
   838 	return doEnumeration;
   855 	return doEnumeration;
   839 }
   856 }
   840 
   857 
   841 /**
   858 /**
   842 Requests that the given data provider enumerate its objects.
   859 Requests that the given data provider enumerate its objects.
   843 @param aId data provider ID
   860 @param aId data provider ID
   844 */
   861 */
   845 void CMTPDataProviderController::EnumerateDataProviderObjectsL(TUint aId)
   862 void CMTPDataProviderController::EnumerateDataProviderObjectsL(TUint aId)
   846     {
   863     {
   847     __FLOG(_L8("EnumerateDataProviderObjectsL - Entry"));
   864     OstTraceFunctionEntry0( CMTPDATAPROVIDERCONTROLLER_ENUMERATEDATAPROVIDEROBJECTSL_ENTRY );
       
   865     OstTraceDef1(OST_TRACE_CATEGORY_PRODUCTION, TRACE_IMPORTANT, CMTPDATAPROVIDERCONTROLLER_ENUMERATEDATAPROVIDEROBJECTSL, 
       
   866             "Data provider with DpId %d to enumerate its objects", aId );
   848     CMTPDataProvider& dp(DataProviderL(aId));
   867     CMTPDataProvider& dp(DataProviderL(aId));
   849 
   868 
   850     if (IsObjectsEnumerationNeededL(dp))
   869     if (IsObjectsEnumerationNeededL(dp))
   851         {   
   870         {   
   852         TBool abnormaldown = ETrue;
   871         TBool abnormaldown = ETrue;
   876         {
   895         {
   877         //The DP does not need enumeration this time, so just change the state to go on.
   896         //The DP does not need enumeration this time, so just change the state to go on.
   878         EnumerationStateChangedL(dp);
   897         EnumerationStateChangedL(dp);
   879         }
   898         }
   880 
   899 
   881     __FLOG(_L8("EnumerateDataProviderObjectsL - Exit"));
   900     OstTraceFunctionExit0( CMTPDATAPROVIDERCONTROLLER_ENUMERATEDATAPROVIDEROBJECTSL_EXIT );
   882     }
   901     }
   883     
   902     
   884 /**
   903 /**
   885 Loads the dataprovider on ROM drives depending upon the mode and activates the specified ECOM data provider.
   904 Loads the dataprovider on ROM drives depending upon the mode and activates the specified ECOM data provider.
   886 @param aResourceFilename The data provider registration and configuration data 
   905 @param aResourceFilename The data provider registration and configuration data 
   890 @return ETrue if data provider is successfully loaded, EFalse otherwise.
   909 @return ETrue if data provider is successfully loaded, EFalse otherwise.
   891 @leave One of the system wide error codes, if a processing failure occurs. 
   910 @leave One of the system wide error codes, if a processing failure occurs. 
   892 */
   911 */
   893 TBool CMTPDataProviderController::LoadROMDataProvidersL(const TDesC& aResourceFilename, const RImplInfoPtrArray& aImplementations)
   912 TBool CMTPDataProviderController::LoadROMDataProvidersL(const TDesC& aResourceFilename, const RImplInfoPtrArray& aImplementations)
   894     {
   913     {
   895     __FLOG(_L8("LoadROMDataProvidersL - Entry"));
   914     OstTraceFunctionEntry0( CMTPDATAPROVIDERCONTROLLER_LOADROMDATAPROVIDERSL_ENTRY );
   896     // Retrieve the implementation UID
   915     // Retrieve the implementation UID
   897     TUint uid(0);
   916     TUint uid(0);
   898     User::LeaveIfError(Uid(aResourceFilename, uid));
   917     LEAVEIFERROR(Uid(aResourceFilename, uid),
       
   918             OstTraceExt1( TRACE_ERROR, CMTPDATAPROVIDERCONTROLLER_LOADROMDATAPROVIDERSL, "can't get uid from resource file %S", aResourceFilename));
       
   919             
   899     TBool success(EFalse);
   920     TBool success(EFalse);
   900 
   921 
   901     // Check for a corresponding plug-in implementation.
   922     // Check for a corresponding plug-in implementation.
   902     TInt index = aImplementations.FindInOrder(TUid::Uid(uid), ImplementationsLinearOrderUid);
   923     TInt index = aImplementations.FindInOrder(TUid::Uid(uid), ImplementationsLinearOrderUid);
   903     if (index >= 0)
   924     if (index >= 0)
   929             files.ResetAndDestroy();  	        	
   950             files.ResetAndDestroy();  	        	
   930             }
   951             }
   931         success = LoadDataProviderL(filename);
   952         success = LoadDataProviderL(filename);
   932         CleanupStack::PopAndDestroy(&filename);
   953         CleanupStack::PopAndDestroy(&filename);
   933         }    	
   954         }    	
   934     __FLOG(_L8("LoadROMDataProvidersL - Exit"));
   955     OstTraceFunctionExit0( CMTPDATAPROVIDERCONTROLLER_LOADROMDATAPROVIDERSL_EXIT );
   935     return success;
   956     return success;
   936     }
   957     }
   937 
   958 
   938 /**
   959 /**
   939 Load all data providers installed on non-ROM drives depending upon the mode and activates 
   960 Load all data providers installed on non-ROM drives depending upon the mode and activates 
   942 implementation UID).
   963 implementation UID).
   943 @leave One of the system wide error codes, if a processing failure occurs. 
   964 @leave One of the system wide error codes, if a processing failure occurs. 
   944 */
   965 */
   945 void CMTPDataProviderController::LoadInstalledDataProvidersL(const CImplementationInformation* aImplementations)
   966 void CMTPDataProviderController::LoadInstalledDataProvidersL(const CImplementationInformation* aImplementations)
   946     {
   967     {
   947     __FLOG(_L8("LoadInstalledDataProvidersL - Entry"));
   968     OstTraceFunctionEntry0( CMTPDATAPROVIDERCONTROLLER_LOADINSTALLEDDATAPROVIDERSL_ENTRY );
   948     TUint uid = aImplementations->ImplementationUid().iUid;
   969     TUint uid = aImplementations->ImplementationUid().iUid;
   949     TBool tFlag(EFalse);
   970     TBool tFlag(EFalse);
   950     iNextDpId = iSingletons.ObjectMgr().DPIDL(uid, tFlag);
   971     iNextDpId = iSingletons.ObjectMgr().DPIDL(uid, tFlag);
   951     if(!tFlag)
   972     if(!tFlag)
   952         {
   973         {
   966         //Skip "0x".
   987         //Skip "0x".
   967         pkgIDstr = pkgIDstr.Mid(searchindex + 2);
   988         pkgIDstr = pkgIDstr.Mid(searchindex + 2);
   968         }
   989         }
   969     if (0 == pkgIDstr.Length())
   990     if (0 == pkgIDstr.Length())
   970         {
   991         {
       
   992         OstTrace0( TRACE_ERROR, CMTPDATAPROVIDERCONTROLLER_LOADINSTALLEDDATAPROVIDERSL, "pkgIdstr is empty!" );
   971         User::Leave(KErrArgument);
   993         User::Leave(KErrArgument);
   972         }
   994         }
   973     
   995     
   974     TUint aUid(0);
   996     TUint aUid(0);
   975     User::LeaveIfError(Uid(pkgIDstr, aUid));
   997     LEAVEIFERROR(Uid(pkgIDstr, aUid),
       
   998             OstTraceExt1( TRACE_ERROR, DUP1_CMTPDATAPROVIDERCONTROLLER_LOADINSTALLEDDATAPROVIDERSL, "can't get uid from string %S",pkgIDstr ));
       
   999             
   976     
  1000     
   977     iSingletons.ObjectMgr().InsertPkgIDObjectL(iNextDpId, aUid);
  1001     iSingletons.ObjectMgr().InsertPkgIDObjectL(iNextDpId, aUid);
   978     TDriveName drive = aImplementations->Drive().Name();
  1002     TDriveName drive = aImplementations->Drive().Name();
   979     RBuf resourcefilename;
  1003     RBuf resourcefilename;
   980     CleanupClosePushL(resourcefilename);  
  1004     CleanupClosePushL(resourcefilename);  
   993     CleanupStack::PopAndDestroy(&rscfile);
  1017     CleanupStack::PopAndDestroy(&rscfile);
   994    
  1018    
   995     LoadDataProviderL(resourcefilename);
  1019     LoadDataProviderL(resourcefilename);
   996 
  1020 
   997     CleanupStack::PopAndDestroy(&resourcefilename);
  1021     CleanupStack::PopAndDestroy(&resourcefilename);
   998     __FLOG(_L8("LoadInstalledDataProvidersL - Exit"));
  1022     OstTraceFunctionExit0( CMTPDATAPROVIDERCONTROLLER_LOADINSTALLEDDATAPROVIDERSL_EXIT );
   999     }
  1023     }
  1000 
  1024 
  1001 /**
  1025 /**
  1002 Load data providers
  1026 Load data providers
  1003 @param aImplementations The installed ECOM data provider implementations list (ordered by 
  1027 @param aImplementations The installed ECOM data provider implementations list (ordered by 
  1005 @return ETrue if data provider is successfully loaded, EFalse otherwise.
  1029 @return ETrue if data provider is successfully loaded, EFalse otherwise.
  1006 @leave One of the system wide error codes, if a processing failure occurs. 
  1030 @leave One of the system wide error codes, if a processing failure occurs. 
  1007 */
  1031 */
  1008 TBool CMTPDataProviderController::LoadDataProviderL(const TDesC& aResourceFilename)
  1032 TBool CMTPDataProviderController::LoadDataProviderL(const TDesC& aResourceFilename)
  1009     {
  1033     {
  1010     __FLOG(_L8("LoadDataProviderL - Entry"));
  1034     OstTraceFunctionEntry0( CMTPDATAPROVIDERCONTROLLER_LOADDATAPROVIDERL_ENTRY );
  1011     // Load the configurability parameter data.
  1035     // Load the configurability parameter data.
  1012     CMTPDataProviderConfig* config(CreateConfigLC(aResourceFilename));
  1036     CMTPDataProviderConfig* config(CreateConfigLC(aResourceFilename));
  1013     
  1037     
  1014     
  1038     
  1015     TBool success(EFalse);
  1039     TBool success(EFalse);
  1016     TBool supported(ETrue);
  1040     TBool supported(ETrue);
  1017     TUint aUid(0);
  1041     TUint aUid(0);
  1018     if ( Uid(aResourceFilename,aUid) != KErrNone )
  1042     if ( Uid(aResourceFilename,aUid) != KErrNone )
  1019        	{
  1043        	{
       
  1044         OstTraceFunctionExit0( CMTPDATAPROVIDERCONTROLLER_LOADDATAPROVIDERL_EXIT );
  1020         return success;	
  1045         return success;	
  1021        	}
  1046        	}
  1022     TUint uid(aUid);
  1047     TUint uid(aUid);
  1023     if ((uid != KMTPImplementationUidDeviceDp) && (uid != KMTPImplementationUidProxyDp) && (uid != KMTPImplementationUidFileDp))
  1048     if ((uid != KMTPImplementationUidDeviceDp) && (uid != KMTPImplementationUidProxyDp) && (uid != KMTPImplementationUidFileDp))
  1024         {
  1049         {
  1102     else
  1127     else
  1103         {
  1128         {
  1104         // No data provider was created.
  1129         // No data provider was created.
  1105         CleanupStack::PopAndDestroy(config);
  1130         CleanupStack::PopAndDestroy(config);
  1106         }
  1131         }
  1107     __FLOG(_L8("LoadDataProviderL - Exit"));
  1132     OstTraceFunctionExit0( DUP1_CMTPDATAPROVIDERCONTROLLER_LOADDATAPROVIDERL_EXIT );
  1108     return success;
  1133     return success;
  1109     }
  1134     }
  1110 
  1135 
  1111 /**
  1136 /**
  1112 Provides the implemetation UID associated with the specified data provider 
  1137 Provides the implemetation UID associated with the specified data provider 
  1115 filename.
  1140 filename.
  1116 @param aUid On completion, the implemetation UID.
  1141 @param aUid On completion, the implemetation UID.
  1117 */
  1142 */
  1118 TInt CMTPDataProviderController::Uid(const TDesC& aResourceFilename, TUint& aUid)
  1143 TInt CMTPDataProviderController::Uid(const TDesC& aResourceFilename, TUint& aUid)
  1119     {
  1144     {
  1120     __FLOG(_L8("Uid - Entry"));
  1145     OstTraceFunctionEntry0( CMTPDATAPROVIDERCONTROLLER_UID_ENTRY );
  1121     // Extract the implemetation UID from the filename.
  1146     // Extract the implemetation UID from the filename.
  1122     TParsePtrC parser(aResourceFilename);
  1147     TParsePtrC parser(aResourceFilename);
  1123     TLex lex(parser.Name());
  1148     TLex lex(parser.Name());
  1124     TInt err = lex.Val(aUid, EHex);
  1149     TInt err = lex.Val(aUid, EHex);
  1125     __FLOG(_L8("Uid - Exit"));
  1150     OstTraceFunctionExit0( CMTPDATAPROVIDERCONTROLLER_UID_EXIT );
  1126     return err;
  1151     return err;
  1127     }
  1152     }
  1128 
  1153 
  1129 /**
  1154 /**
  1130 Schedules an enumeration iteration.
  1155 Schedules an enumeration iteration.
  1131 */
  1156 */
  1132 void CMTPDataProviderController::Schedule()
  1157 void CMTPDataProviderController::Schedule()
  1133     {
  1158     {
  1134     __FLOG(_L8("Schedule - Entry"));
  1159     OstTraceFunctionEntry0( CMTPDATAPROVIDERCONTROLLER_SCHEDULE_ENTRY );
  1135     if (!IsActive())
  1160     if (!IsActive())
  1136         {
  1161         {
  1137         TRequestStatus* status(&iStatus);
  1162         TRequestStatus* status(&iStatus);
  1138         *status = KRequestPending;
  1163         *status = KRequestPending;
  1139         SetActive();
  1164         SetActive();
  1140         User::RequestComplete(status, KErrNone);
  1165         User::RequestComplete(status, KErrNone);
  1141         }
  1166         }
  1142     __FLOG(_L8("Schedule - Exit"));
  1167     OstTraceFunctionExit0( CMTPDATAPROVIDERCONTROLLER_SCHEDULE_EXIT );
  1143     }
  1168     }
  1144 /**
  1169 /**
  1145 Get the mtpkey mode.
  1170 Get the mtpkey mode.
  1146 */    
  1171 */    
  1147 TMTPOperationalMode CMTPDataProviderController::Mode()
  1172 TMTPOperationalMode CMTPDataProviderController::Mode()
  1196     if(iStubFound)
  1221     if(iStubFound)
  1197         {
  1222         {
  1198         return;
  1223         return;
  1199         }
  1224         }
  1200             
  1225             
  1201 	User::LeaveIfError(iSisSession.Connect());
  1226 	LEAVEIFERROR(iSisSession.Connect(),
       
  1227 	        OstTrace0( TRACE_ERROR, CMTPDATAPROVIDERCONTROLLER_CREATEREGISTRYSESSIONANDENTRYL, "can't connect to iSisSession " ));
  1202     CleanupClosePushL(iSisSession);
  1228     CleanupClosePushL(iSisSession);
  1203     TInt err = KErrNone;
  1229     TInt err = KErrNone;
  1204     TUint stubuid;
  1230     TUint stubuid;
  1205     iSingletons.FrameworkConfig().GetValueL(CMTPFrameworkConfig::EPackageStubUID , stubuid);
  1231     iSingletons.FrameworkConfig().GetValueL(CMTPFrameworkConfig::EPackageStubUID , stubuid);
  1206  	TRAP_IGNORE(err=iSisEntry.Open(iSisSession, TUid::Uid(stubuid) ));
  1232  	TRAP_IGNORE(err=iSisEntry.Open(iSisSession, TUid::Uid(stubuid) ));
  1220 	iSisSession.Close();
  1246 	iSisSession.Close();
  1221 	}
  1247 	}
  1222 
  1248 
  1223 EXPORT_C void CMTPDataProviderController::SetNeedEnumeratingPhase2(TBool aNeed)
  1249 EXPORT_C void CMTPDataProviderController::SetNeedEnumeratingPhase2(TBool aNeed)
  1224 	{
  1250 	{
  1225 	__FLOG(_L8("SetNeedEnumeratingPhase2 - Entry"));
  1251     OstTraceFunctionEntry0( CMTPDATAPROVIDERCONTROLLER_SETNEEDENUMERATINGPHASE2_ENTRY );
  1226 	__FLOG_VA((_L8("Need = %d"), aNeed)); 
  1252     OstTrace1(TRACE_NORMAL, CMTPDATAPROVIDERCONTROLLER_SETNEEDENUMERATINGPHASE2, "Need = %d", aNeed);
  1227 	
  1253 	
  1228 	iNeedEnumeratingPhase2 = aNeed;
  1254 	iNeedEnumeratingPhase2 = aNeed;
  1229 	
  1255 	
  1230 	__FLOG(_L8("SetNeedEnumeratingPhase2 - Exit"));
  1256 	OstTraceFunctionExit0( CMTPDATAPROVIDERCONTROLLER_SETNEEDENUMERATINGPHASE2_EXIT );
  1231 	}
  1257 	}
  1232 
  1258 
  1233 EXPORT_C TBool CMTPDataProviderController::NeedEnumeratingPhase2() const
  1259 EXPORT_C TBool CMTPDataProviderController::NeedEnumeratingPhase2() const
  1234 	{
  1260 	{
  1235 	return iNeedEnumeratingPhase2;
  1261 	return iNeedEnumeratingPhase2;
  1236 	}
  1262 	}
  1237 
  1263 
  1238 
  1264 
  1239 EXPORT_C void CMTPDataProviderController::RegisterPendingRequestDP(TUint aDpUid, TUint aTimeOut)
  1265 EXPORT_C void CMTPDataProviderController::RegisterPendingRequestDP(TUint aDpUid, TUint aTimeOut)
  1240     {
  1266     {
  1241     __FLOG(_L8("CMTPDataProviderController::RegisterPendingRequestDP - Entry"));
  1267     OstTraceFunctionEntry0( CMTPDATAPROVIDERCONTROLLER_REGISTERPENDINGREQUESTDP_ENTRY );
  1242     
  1268     
  1243     __ASSERT_DEBUG((iPendingRequestDpUid == 0), User::Invariant());
  1269     __ASSERT_DEBUG((iPendingRequestDpUid == 0), User::Invariant());
  1244     iPendingRequestDpUid = aDpUid;
  1270     iPendingRequestDpUid = aDpUid;
  1245     if (aTimeOut > 0)
  1271     if (aTimeOut > 0)
  1246         {
  1272         {
  1247         iPendingRequestTimer->Start(aTimeOut);
  1273         iPendingRequestTimer->Start(aTimeOut);
  1248         }
  1274         }
  1249     
  1275       
  1250     __FLOG(_L8("CMTPDataProviderController::RegisterPendingRequestDP - Exit"));    
  1276     OstTraceFunctionExit0( CMTPDATAPROVIDERCONTROLLER_REGISTERPENDINGREQUESTDP_EXIT );
  1251     }
  1277     }
  1252 
  1278 
  1253 
  1279 
  1254 EXPORT_C void CMTPDataProviderController::ExecutePendingRequestL()
  1280 EXPORT_C void CMTPDataProviderController::ExecutePendingRequestL()
  1255     {
  1281     {
  1256     __FLOG(_L8("CMTPDataProviderController::ExecutePendingRequestL - Entry"));
  1282     OstTraceFunctionEntry0( CMTPDATAPROVIDERCONTROLLER_EXECUTEPENDINGREQUESTL_ENTRY );
  1257     
  1283     
  1258     if (iPendingRequestDpUid == 0)
  1284     if (iPendingRequestDpUid == 0)
  1259         {
  1285         {
  1260         iPendingRequestTimer->Cancel();
  1286         iPendingRequestTimer->Cancel();
       
  1287         OstTraceFunctionExit0( CMTPDATAPROVIDERCONTROLLER_EXECUTEPENDINGREQUESTL_EXIT );
  1261         return;
  1288         return;
  1262         }
  1289         }
  1263     
  1290     
  1264     int i = 0;
  1291     int i = 0;
  1265     int count = iDataProviders.Count();
  1292     int count = iDataProviders.Count();
  1271             iPendingRequestDpUid = 0;
  1298             iPendingRequestDpUid = 0;
  1272             break;
  1299             break;
  1273             }
  1300             }
  1274         }
  1301         }
  1275     
  1302     
  1276     iPendingRequestTimer->Cancel();
  1303     iPendingRequestTimer->Cancel();   
  1277     __FLOG(_L8("CMTPDataProviderController::ExecutePendingRequestL - Exit"));    
  1304     OstTraceFunctionExit0( DUP1_CMTPDATAPROVIDERCONTROLLER_EXECUTEPENDINGREQUESTL_EXIT );
  1278     }
  1305     }
  1279 
  1306 
  1280 EXPORT_C TUint CMTPDataProviderController::StorageEnumerateState(TUint aStorageId)
  1307 EXPORT_C TUint CMTPDataProviderController::StorageEnumerateState(TUint aStorageId)
  1281     {
  1308     {
  1282     if (iEnumeratingStorages.Count() == 0)
  1309     if (iEnumeratingStorages.Count() == 0)
  1318     return self;
  1345     return self;
  1319     }
  1346     }
  1320 
  1347 
  1321 CMTPDataProviderController::CMTPPendingReqestTimer::~CMTPPendingReqestTimer()
  1348 CMTPDataProviderController::CMTPPendingReqestTimer::~CMTPPendingReqestTimer()
  1322     {
  1349     {
  1323     __FLOG(_L8("~CMTPPendingReqestTimer - Entry"));  
  1350     OstTraceFunctionEntry0( CMTPPENDINGREQESTTIMER_CMTPPENDINGREQESTTIMER_ENTRY );
  1324     
  1351     
  1325     Cancel();
  1352     Cancel();
  1326     
  1353     
  1327     __FLOG(_L8("~CMTPPendingReqestTimer - Exit"));    
  1354     OstTraceFunctionExit0( CMTPPENDINGREQESTTIMER_CMTPPENDINGREQESTTIMER_EXIT );
  1328     __FLOG_CLOSE;
       
  1329     
       
  1330     }
  1355     }
  1331           
  1356           
  1332 void CMTPDataProviderController::CMTPPendingReqestTimer::Start(TUint aTimeOut)
  1357 void CMTPDataProviderController::CMTPPendingReqestTimer::Start(TUint aTimeOut)
  1333     {
  1358     {
  1334     __FLOG(_L8("CMTPPendingReqestTimer::Start - Entry"));
  1359     OstTraceFunctionEntry0( CMTPPENDINGREQESTTIMER_START_ENTRY );
  1335     
  1360     
  1336     if (aTimeOut > 0)
  1361     if (aTimeOut > 0)
  1337         {
  1362         {
  1338         const TUint KMTPPendingRequestDelay = (1000000 * aTimeOut);
  1363         const TUint KMTPPendingRequestDelay = (1000000 * aTimeOut);
  1339         After(KMTPPendingRequestDelay);
  1364         After(KMTPPendingRequestDelay);
  1340         }
  1365         }
  1341     
  1366 
  1342     __FLOG(_L8("CMTPPendingReqestTimer::Start - Exit"));
  1367     OstTraceFunctionExit0( CMTPPENDINGREQESTTIMER_START_EXIT );
  1343     }
  1368     }
  1344         
  1369         
  1345 void CMTPDataProviderController::CMTPPendingReqestTimer::RunL()
  1370 void CMTPDataProviderController::CMTPPendingReqestTimer::RunL()
  1346     {
  1371     {
  1347     __FLOG(_L8("CMTPPendingReqestTimer::RunL - Entry"));
  1372     OstTraceFunctionEntry0( CMTPPENDINGREQESTTIMER_RUNL_ENTRY );
  1348 
  1373 
  1349     iDPController->ExecutePendingRequestL();
  1374     iDPController->ExecutePendingRequestL();
  1350     
  1375     
  1351     __FLOG(_L8("CMTPPendingReqestTimer::RunL - Exit"));
  1376     OstTraceFunctionExit0( CMTPPENDINGREQESTTIMER_RUNL_EXIT );
  1352     }
  1377     }
  1353 
  1378 
  1354 CMTPDataProviderController::CMTPPendingReqestTimer::CMTPPendingReqestTimer(CMTPDataProviderController* aDPController) :
  1379 CMTPDataProviderController::CMTPPendingReqestTimer::CMTPPendingReqestTimer(CMTPDataProviderController* aDPController) :
  1355     CTimer(EPriorityNormal)
  1380     CTimer(EPriorityNormal)
  1356     {
  1381     {
  1357     iDPController = aDPController;
  1382     iDPController = aDPController;
  1358     }
  1383     }
  1359 
  1384 
  1360 void CMTPDataProviderController::CMTPPendingReqestTimer::ConstructL()
  1385 void CMTPDataProviderController::CMTPPendingReqestTimer::ConstructL()
  1361     {
  1386     {
  1362     __FLOG_OPEN(KMTPSubsystem, KComponent);
  1387     OstTraceFunctionEntry0( CMTPPENDINGREQESTTIMER_CONSTRUCTL_ENTRY );
  1363     __FLOG(_L8("CMTPPendingReqestTimer::ConstructL - Entry"));
       
  1364 
  1388 
  1365     CTimer::ConstructL();
  1389     CTimer::ConstructL();
  1366     CActiveScheduler::Add(this);
  1390     CActiveScheduler::Add(this);
  1367     
  1391       
  1368     __FLOG(_L8("CMTPPendingReqestTimer::ConstructL - Exit"));    
  1392     OstTraceFunctionExit0( CMTPPENDINGREQESTTIMER_CONSTRUCTL_EXIT );
  1369     }
  1393     }
  1370 
  1394