Revision: 201005
authorDremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Mon, 03 May 2010 13:19:02 +0300
changeset 20 6e82ae192c3a
parent 18 1b39655331a3
child 22 a5c0bb5018eb
child 29 3ae5cb0b4c02
Revision: 201005 Kit: 201018
backupandrestore/backupengine/group/sbengine.mmp
backupandrestore/backupengine/src/sbedataownermanager.cpp
backupandrestore/backupengine/src/sbpackagedatatransfer.cpp
mtpdataproviders/mtpfileandfolderdp/src/cmtpfiledp.cpp
mtpdataproviders/mtpfileandfolderdp/src/mtpfiledp_config.rss
mtpdataproviders/mtpimagedp/inc/cmtpimagedp.h
mtpdataproviders/mtpimagedp/inc/cmtpimagedpobjectpropertymgr.h
mtpdataproviders/mtpimagedp/src/cmtpimagedp.cpp
mtpdataproviders/mtpimagedp/src/cmtpimagedpgetobjectproplist.cpp
mtpdataproviders/mtpimagedp/src/cmtpimagedpgetobjectpropvalue.cpp
mtpdataproviders/mtpimagedp/src/cmtpimagedpobjectpropertymgr.cpp
mtpdataproviders/mtpimagedp/src/cmtpimagedpthumbnailcreator.cpp
mtpfws/mtpfw/bwins/mtpframeworkU.DEF
mtpfws/mtpfw/common/inc/mtpdatacapture.h
mtpfws/mtpfw/common/inc/uiklafinternalcrkeys.h
mtpfws/mtpfw/conf/mtpframework.confml
mtpfws/mtpfw/conf/mtpframework_10282fcc.crml
mtpfws/mtpfw/daemon/server/group/mtpserver.mmp
mtpfws/mtpfw/daemon/server/src/cmtpserversession.cpp
mtpfws/mtpfw/dataproviders/dataproviderapi/interface/mmtpdataproviderframework.h
mtpfws/mtpfw/dataproviders/devdp/group/mtpdevicedp.mmp
mtpfws/mtpfw/dataproviders/devdp/inc/cmtpgetnumobjects.h
mtpfws/mtpfw/dataproviders/devdp/inc/mtpdevicedpconst.h
mtpfws/mtpfw/dataproviders/devdp/src/cmtpdevicedatastore.cpp
mtpfws/mtpfw/dataproviders/devdp/src/cmtpdevicedp.cpp
mtpfws/mtpfw/dataproviders/devdp/src/cmtpgetdevicepropdesc.cpp
mtpfws/mtpfw/dataproviders/devdp/src/cmtpgetnumobjects.cpp
mtpfws/mtpfw/dataproviders/devdp/src/cmtpgetobjecthandles.cpp
mtpfws/mtpfw/dataproviders/devdp/src/cmtpgetstorageinfo.cpp
mtpfws/mtpfw/dataproviders/devdp/src/cmtpopensession.cpp
mtpfws/mtpfw/dataproviders/devdp/src/cmtpresetdevicepropvalue.cpp
mtpfws/mtpfw/dataproviders/devdp/src/mtpdevicedp_config.rss
mtpfws/mtpfw/dataproviders/devdp/src/mtpdevicedpprocessor.cpp
mtpfws/mtpfw/dataproviders/dputility/bwins/mtpdataproviderutilityu.def
mtpfws/mtpfw/dataproviders/dputility/eabi/mtpdataproviderutilityu.def
mtpfws/mtpfw/dataproviders/dputility/inc/cmtpfsenumerator.h
mtpfws/mtpfw/dataproviders/dputility/inc/cmtpmoveobject.h
mtpfws/mtpfw/dataproviders/dputility/inc/cmtprequestprocessor.h
mtpfws/mtpfw/dataproviders/dputility/inc/cmtpsetobjectprotection.h
mtpfws/mtpfw/dataproviders/dputility/src/cmtpcopyobject.cpp
mtpfws/mtpfw/dataproviders/dputility/src/cmtpfsenumerator.cpp
mtpfws/mtpfw/dataproviders/dputility/src/cmtpmoveobject.cpp
mtpfws/mtpfw/dataproviders/dputility/src/cmtprequestprocessor.cpp
mtpfws/mtpfw/dataproviders/dputility/src/cmtpsetobjectpropvalue.cpp
mtpfws/mtpfw/dataproviders/dputility/src/cmtpsetobjectprotection.cpp
mtpfws/mtpfw/dataproviders/proxydp/src/cmtpdeleteobject.cpp
mtpfws/mtpfw/dataproviders/proxydp/src/cmtpgetobjectproplist.cpp
mtpfws/mtpfw/dataproviders/proxydp/src/cmtpsetobjectproplist.cpp
mtpfws/mtpfw/datatypes/bwins/mtpdatatypesU.DEF
mtpfws/mtpfw/datatypes/bwins/mtpdatatypes_f32U.DEF
mtpfws/mtpfw/datatypes/eabi/mtpdatatypesU.DEF
mtpfws/mtpfw/datatypes/group/mtpdatatypes.mmp
mtpfws/mtpfw/datatypes/interface/mtpdatatypeconstants.h
mtpfws/mtpfw/datatypes/interface/tmtptypeguid.h
mtpfws/mtpfw/datatypes/interface/tmtptyperesponse.h
mtpfws/mtpfw/datatypes/src/cmtptypefile.cpp
mtpfws/mtpfw/datatypes/src/tmtptypeguid.cpp
mtpfws/mtpfw/datatypes/src/tmtptyperesponse.cpp
mtpfws/mtpfw/eabi/mtpframeworkU.DEF
mtpfws/mtpfw/group/10282FCC_ARMV5.cre
mtpfws/mtpfw/group/10282FCC_ARMV5.txt
mtpfws/mtpfw/group/10282FCC_WINSCW.cre
mtpfws/mtpfw/group/10282FCC_WINSCW.txt
mtpfws/mtpfw/inc/cmtpdataprovider.h
mtpfws/mtpfw/inc/cmtpdataprovidercontroller.h
mtpfws/mtpfw/inc/cmtpobjectstore.h
mtpfws/mtpfw/inc/mtpframeworkconst.h
mtpfws/mtpfw/src/cmtpconnection.cpp
mtpfws/mtpfw/src/cmtpdataprovider.cpp
mtpfws/mtpfw/src/cmtpdataproviderconfig.cpp
mtpfws/mtpfw/src/cmtpdataprovidercontroller.cpp
mtpfws/mtpfw/src/cmtpobjectstore.cpp
mtpfws/mtpfw/src/cmtpparserrouter.cpp
mtptransports/mtpusbtransport/usbdatatypes/src/tmtpusbparameterpayloadblock.cpp
mtptransports/mtpusbtransport/usbsic_imp/src/cmtpusbconnection.cpp
--- a/backupandrestore/backupengine/group/sbengine.mmp	Fri Apr 16 15:51:48 2010 +0300
+++ b/backupandrestore/backupengine/group/sbengine.mmp	Mon May 03 13:19:02 2010 +0300
@@ -75,7 +75,7 @@
 
 #endif
 
-CAPABILITY ProtServ AllFiles WriteDeviceData ReadUserData
+CAPABILITY ProtServ AllFiles WriteDeviceData ReadUserData TrustedUi
 
 START WINS      
 // ?wins_specific_information
--- a/backupandrestore/backupengine/src/sbedataownermanager.cpp	Fri Apr 16 15:51:48 2010 +0300
+++ b/backupandrestore/backupengine/src/sbedataownermanager.cpp	Mon May 03 13:19:02 2010 +0300
@@ -575,12 +575,11 @@
 						CPackageDataTransfer* pak = FindPackageDataContainerL(packageUid);
 						//renews the drive list
 						TRAP(err, pak->GetDriveListL(driveList));
-						if (err != KErrNone)
-                            {//Non-removable, ignore this data owner
-                            iDataOwners.Remove(count);
-                            CleanupStack::PopAndDestroy(pId);
-                            continue;
-                            }
+						if( err == KErrNotSupported)
+							{
+							__LOG("CDataOwnerManager::GetDataOwnersL() - Error KErrNotSupported");
+							err = KErrNone;
+							}
 						} // if
 					else
 						{
--- a/backupandrestore/backupengine/src/sbpackagedatatransfer.cpp	Fri Apr 16 15:51:48 2010 +0300
+++ b/backupandrestore/backupengine/src/sbpackagedatatransfer.cpp	Mon May 03 13:19:02 2010 +0300
@@ -354,12 +354,14 @@
             if(KErrNotSupported == err)
                 {//Non-Removable package, nothing to backup
                 iState.iState = ENone;
+                aLastSection = ETrue;
                 Cleanup();
                 return;
                 }
             else if(KErrNone != err)
                 {
                 iState.iState = ENone;
+                aLastSection = ETrue;
                 Cleanup();
                 User::Leave(err);
                 }
@@ -1413,12 +1415,22 @@
 		// We now no longer return the Z drive, it has been decided that the Z drive will always be the
 		// ROM. Backing up and restoring the ROM drive should not be possible, as what is the point
 		
-		// build package files
+		// build package files        
 		if (iMetaData == NULL)
 			{
-			iMetaData = iSWIBackup.GetMetaDataL(iPackageID, iFiles);
-			iMetaDataSize = iMetaData->Size();
-			BuildPackageFileList();
+			TRAPD( err, iMetaData = iSWIBackup.GetMetaDataL(iPackageID, iFiles) );
+			
+			if( err )
+				{
+				iMetaData = NULL;
+				iMetaDataSize = 0;
+				User::Leave( err );
+				}
+			else
+				{
+				iMetaDataSize = iMetaData->Size();
+				BuildPackageFileList();				
+				}
 			}
 		
 		TDriveList notToBackup = ipDataOwnerManager->Config().ExcludeDriveList();
@@ -1433,6 +1445,7 @@
 			}
 		
 		aDriveList = iDriveList;
+		
 		__LOG1("CPackageDataTransfer::GetDriveListL() - end - SID: 0x%08x", iPackageID.iUid);
 		}
 
--- a/mtpdataproviders/mtpfileandfolderdp/src/cmtpfiledp.cpp	Fri Apr 16 15:51:48 2010 +0300
+++ b/mtpdataproviders/mtpfileandfolderdp/src/cmtpfiledp.cpp	Mon May 03 13:19:02 2010 +0300
@@ -136,14 +136,11 @@
 void CMTPFileDataProvider::StartObjectEnumerationL(TUint32 aStorageId, TBool /*aPersistentFullEnumeration*/)
     {
     __FLOG(_L8("StartObjectEnumerationL - Entry"));
-
     iPendingEnumerations.AppendL(aStorageId);
-    if (iPendingEnumerations.Count() == 1)
-        {
-		CMTPDataProviderController& dpController(iSingletons.DpController());
-		TBool bOnlyScanRoot = ( (dpController.EnumerateState() == CMTPDataProviderController::EEnumeratingFrameworkObjects) && (dpController.NeedEnumeratingPhase2()) );
-		iFileEnumerator->StartL(iPendingEnumerations[KActiveEnumeration], bOnlyScanRoot);
-        }
+    CMTPDataProviderController& dpController(iSingletons.DpController());
+    //must read this NeedEnumeratingPhase2 before this function return
+    TBool bScanAll = dpController.NeedEnumeratingPhase2();
+    iFileEnumerator->StartL(iPendingEnumerations[KActiveEnumeration], bScanAll);
     __FLOG(_L8("StartObjectEnumerationL - Exit"));
     }
     
@@ -222,12 +219,6 @@
     
     Framework().ObjectEnumerationCompleteL(iPendingEnumerations[KActiveEnumeration]);
     iPendingEnumerations.Remove(KActiveEnumeration);
-    if (iPendingEnumerations.Count())
-        {
-		CMTPDataProviderController& dpController(iSingletons.DpController());
-		TBool bOnlyScanRoot = ( (dpController.EnumerateState() == CMTPDataProviderController::EEnumeratingFrameworkObjects) && (dpController.NeedEnumeratingPhase2()) );
-        iFileEnumerator->StartL(iPendingEnumerations[KActiveEnumeration], bOnlyScanRoot);
-        }
     __FLOG(_L8("HandleEnumerationCompletedL - Exit"));
     }
     
--- a/mtpdataproviders/mtpfileandfolderdp/src/mtpfiledp_config.rss	Fri Apr 16 15:51:48 2010 +0300
+++ b/mtpdataproviders/mtpfileandfolderdp/src/mtpfiledp_config.rss	Mon May 03 13:19:02 2010 +0300
@@ -25,6 +25,7 @@
     server_name = "";
     server_image_name = "";
     opaque_resource = fileConfig;
+    enumeration_phase = 1;
     }
 
 RESOURCE MTP_FILEDP_CONFIG fileConfig
--- a/mtpdataproviders/mtpimagedp/inc/cmtpimagedp.h	Fri Apr 16 15:51:48 2010 +0300
+++ b/mtpdataproviders/mtpimagedp/inc/cmtpimagedp.h	Mon May 03 13:19:02 2010 +0300
@@ -137,6 +137,7 @@
     TInt                    iActiveProcessor;
     TBool                   iActiveProcessorRemoved;    
     TBool                   iEnumerated;
+    TBool                   iEnumerationNotified;
 	
 	RPointerArray<HBufC>    iDeleteObjectsArray;
     };
--- a/mtpdataproviders/mtpimagedp/inc/cmtpimagedpobjectpropertymgr.h	Fri Apr 16 15:51:48 2010 +0300
+++ b/mtpdataproviders/mtpimagedp/inc/cmtpimagedpobjectpropertymgr.h	Mon May 03 13:19:02 2010 +0300
@@ -67,11 +67,11 @@
     
     void GetPropertyL(TMTPObjectPropertyCode aProperty, TUint8& aValue);
     void GetPropertyL(TMTPObjectPropertyCode aProperty, TUint16& aValue);
-    void GetPropertyL(TMTPObjectPropertyCode aProperty, TUint32& aValue);
+    void GetPropertyL(TMTPObjectPropertyCode aProperty, TUint32& aValue, TBool alwaysCreate = ETrue);
     void GetPropertyL(TMTPObjectPropertyCode aProperty, TUint64& aValue);
     void GetPropertyL(TMTPObjectPropertyCode aProperty, TMTPTypeUint128& aValue);
     void GetPropertyL(TMTPObjectPropertyCode aProperty, CMTPTypeString& aValue);
-    void GetPropertyL(TMTPObjectPropertyCode aProperty, CMTPTypeArray& aValue);
+    void GetPropertyL(TMTPObjectPropertyCode aProperty, CMTPTypeArray& aValue, TBool alwaysCreate = ETrue);
     
     //clear the cache
     void ClearCacheL();
--- a/mtpdataproviders/mtpimagedp/src/cmtpimagedp.cpp	Fri Apr 16 15:51:48 2010 +0300
+++ b/mtpdataproviders/mtpimagedp/src/cmtpimagedp.cpp	Mon May 03 13:19:02 2010 +0300
@@ -128,6 +128,7 @@
         User::LeaveIfError(error);
         }    
     
+    iEnumerationNotified = ETrue;
     __FLOG(_L8("<< CMTPImageDataProvider::ConstructL"));
     }
 
@@ -271,6 +272,8 @@
     __FLOG(_L8(">> StartObjectEnumerationL"));
     
     TBool isComplete = ETrue;
+    iEnumerationNotified = EFalse;
+
     if (aStorageId == KMTPStorageAll)
         {
         /*
@@ -479,7 +482,11 @@
     __FLOG(_L8(">> NotifyEnumerationCompletedL"));
     __FLOG_VA((_L8("Enumeration of storage 0x%08X completed with error status %d"), aStorageId, aError));
         
-    Framework().ObjectEnumerationCompleteL(aStorageId);
+    if (!iEnumerationNotified)
+        {
+        iEnumerationNotified = ETrue;
+        Framework().ObjectEnumerationCompleteL(aStorageId);
+        }
     
     __FLOG(_L8("<< HandleEnumerationCompletedL"));
     }
@@ -656,6 +663,11 @@
     /**
      * copy file extension by insensitive case
      */
+    if (aExtension.Length() > KMaxExtNameLength)
+        {
+        return KNullDesC;
+        }
+    
     TBuf<KMaxExtNameLength> extension;
     extension.CopyLC(aExtension);
     
--- a/mtpdataproviders/mtpimagedp/src/cmtpimagedpgetobjectproplist.cpp	Fri Apr 16 15:51:48 2010 +0300
+++ b/mtpdataproviders/mtpimagedp/src/cmtpimagedpgetobjectproplist.cpp	Mon May 03 13:19:02 2010 +0300
@@ -146,12 +146,7 @@
     TUint32 propCode = Request().Uint32(TMTPTypeRequest::ERequestParameter3);
     if (propCode == 0)
         {
-            TUint32 groupCode = Request().Uint32(TMTPTypeRequest::ERequestParameter4);
-            if(groupCode != KMTPImageDpPropertyGroupOneNumber)
-            {
-            //Only supported group one
-            response = EMTPRespCodeSpecificationByGroupUnsupported;
-            }
+            /*Do nothing */
         }
     else if (propCode != KMaxTUint)
         {
@@ -309,15 +304,18 @@
 void CMTPImageDpGetObjectPropList::ServiceGroupPropertiesL(TUint32 aHandle,TUint16 /*aGroupCode*/)
     {
     __FLOG(_L8(">> CMTPImageDpGetObjectPropList::ServiceGroupPropertiesL"));
-    
-    if (iFramework.ObjectMgr().ObjectOwnerId(aHandle) == iFramework.DataProviderId())
+    TUint32 groupCode = Request().Uint32(TMTPTypeRequest::ERequestParameter4);
+    if (KMTPImageDpPropertyGroupOneNumber == groupCode) //only return data for group one
         {
-        for (TUint propCodeIndex(0); propCodeIndex < KMTPImageDpGroupOneSize; propCodeIndex++)
+        if (iFramework.ObjectMgr().ObjectOwnerId(aHandle) == iFramework.DataProviderId())
             {
-            TUint16 propCode = KMTPImageDpGroupOneProperties[propCodeIndex];  
-            if(propCode != 0)
+            for (TUint propCodeIndex(0); propCodeIndex < KMTPImageDpGroupOneSize; propCodeIndex++)
                 {
-                ServiceOneObjectPropertyL(aHandle, propCode);
+                TUint16 propCode = KMTPImageDpGroupOneProperties[propCodeIndex];  
+                if(propCode != 0)
+                    {
+                    ServiceOneObjectPropertyL(aHandle, propCode);
+                    }
                 }
             }
         }
@@ -366,7 +364,7 @@
         case EMTPObjectPropCodeRepresentativeSampleWidth:
             {
             TUint32 value;
-            iPropertyMgr.GetPropertyL(TMTPObjectPropertyCode(aPropCode), value);
+            iPropertyMgr.GetPropertyL(TMTPObjectPropertyCode(aPropCode), value, EFalse);
             CMTPTypeObjectPropListElement& propElem = iPropertyList->ReservePropElemL(aHandle, propCode); 
             propElem.SetUint32L(CMTPTypeObjectPropListElement::EValue, value);
             iPropertyList->CommitPropElemL(propElem);
@@ -376,7 +374,7 @@
         case EMTPObjectPropCodeRepresentativeSampleData:
             {
             CMTPTypeArray* value = CMTPTypeArray::NewLC(EMTPTypeAUINT8);
-            iPropertyMgr.GetPropertyL(TMTPObjectPropertyCode(aPropCode), *value);            
+            iPropertyMgr.GetPropertyL(TMTPObjectPropertyCode(aPropCode), *value, EFalse);            
             CMTPTypeObjectPropListElement& propElem = iPropertyList->ReservePropElemL(aHandle, propCode);
             propElem.SetArrayL(CMTPTypeObjectPropListElement::EValue, *value);            
             iPropertyList->CommitPropElemL(propElem);
--- a/mtpdataproviders/mtpimagedp/src/cmtpimagedpgetobjectpropvalue.cpp	Fri Apr 16 15:51:48 2010 +0300
+++ b/mtpdataproviders/mtpimagedp/src/cmtpimagedpgetobjectpropvalue.cpp	Mon May 03 13:19:02 2010 +0300
@@ -315,7 +315,7 @@
 void CMTPImageDpGetObjectPropValue::ServiceRepresentativeSampleSizeL()
     {
     TUint32 representativeSampleSize;
-    iObjectPropertyMgr.GetPropertyL(EMTPObjectPropCodeRepresentativeSampleSize, representativeSampleSize);
+    iObjectPropertyMgr.GetPropertyL(EMTPObjectPropCodeRepresentativeSampleSize, representativeSampleSize, EFalse);
     iMTPTypeUint32.Set(representativeSampleSize);
     
     SendDataL(iMTPTypeUint32);
@@ -341,7 +341,7 @@
 
 void CMTPImageDpGetObjectPropValue::ServiceRepresentativeSampleDataL()
     {
-    iObjectPropertyMgr.GetPropertyL(EMTPObjectPropCodeRepresentativeSampleData, *iMTPTypeArray);
+    iObjectPropertyMgr.GetPropertyL(EMTPObjectPropCodeRepresentativeSampleData, *iMTPTypeArray, EFalse);
     
     SendDataL(*iMTPTypeArray);
     }
--- a/mtpdataproviders/mtpimagedp/src/cmtpimagedpobjectpropertymgr.cpp	Fri Apr 16 15:51:48 2010 +0300
+++ b/mtpdataproviders/mtpimagedp/src/cmtpimagedpobjectpropertymgr.cpp	Mon May 03 13:19:02 2010 +0300
@@ -422,7 +422,7 @@
     __FLOG(_L8("<< CMTPImageDpObjectPropertyMgr::GetPropertyL"));
     }
 
-void CMTPImageDpObjectPropertyMgr::GetPropertyL(TMTPObjectPropertyCode aProperty, TUint32 &aValue)
+void CMTPImageDpObjectPropertyMgr::GetPropertyL(TMTPObjectPropertyCode aProperty, TUint32 &aValue, TBool alwaysCreate/* = ETrue*/)
     {
     __FLOG(_L8(">> CMTPImageDpObjectPropertyMgr::GetPropertyL"));
     __ASSERT_DEBUG(iObjectInfo, Panic(EMTPImageDpObjectNull));
@@ -450,11 +450,14 @@
             TInt err = iFs.Entry(iObjectInfo->DesC(CMTPObjectMetaData::ESuid), fileEntry);
             if (err == KErrNone)
                 {
-                iDataProvider.ThumbnailManager().GetThumbMgr()->SetFlagsL(CThumbnailManager::EDefaultFlags);
-                if(fileEntry.FileSize() > KFileSizeMax)
+                if(fileEntry.FileSize() > KFileSizeMax || !alwaysCreate)
                     {
                     iDataProvider.ThumbnailManager().GetThumbMgr()->SetFlagsL(CThumbnailManager::EDoNotCreate);
                     }
+                else
+                    {
+                    iDataProvider.ThumbnailManager().GetThumbMgr()->SetFlagsL(CThumbnailManager::EDefaultFlags);
+                    }
                 
                 /**
                  * trap the leave to avoid return general error when PC get object property list
@@ -578,7 +581,7 @@
     __FLOG(_L8("<< CMTPImageDpObjectPropertyMgr::GetPropertyL"));
     }
 
-void CMTPImageDpObjectPropertyMgr::GetPropertyL(TMTPObjectPropertyCode aProperty, CMTPTypeArray& aValue)
+void CMTPImageDpObjectPropertyMgr::GetPropertyL(TMTPObjectPropertyCode aProperty, CMTPTypeArray& aValue, TBool alwaysCreate /*= ETrue*/)
     {
     __FLOG(_L8(">> CMTPImageDpObjectPropertyMgr::GetPropertyL -- SmapleData"));       
     
@@ -599,11 +602,15 @@
             TInt err = iFs.Entry(iObjectInfo->DesC(CMTPObjectMetaData::ESuid), fileEntry);
             if (err == KErrNone)
                 {
-                iDataProvider.ThumbnailManager().GetThumbMgr()->SetFlagsL(CThumbnailManager::EDefaultFlags);
-                if(fileEntry.FileSize() > KFileSizeMax)
+                
+                if(fileEntry.FileSize() > KFileSizeMax || !alwaysCreate)
                     {
                     iDataProvider.ThumbnailManager().GetThumbMgr()->SetFlagsL(CThumbnailManager::EDoNotCreate);
                     }
+                else
+                    {
+                    iDataProvider.ThumbnailManager().GetThumbMgr()->SetFlagsL(CThumbnailManager::EDefaultFlags);
+                    }
                 
                 /**
                  * trap the leave to avoid return general error when PC get object property list
--- a/mtpdataproviders/mtpimagedp/src/cmtpimagedpthumbnailcreator.cpp	Fri Apr 16 15:51:48 2010 +0300
+++ b/mtpdataproviders/mtpimagedp/src/cmtpimagedpthumbnailcreator.cpp	Mon May 03 13:19:02 2010 +0300
@@ -261,10 +261,17 @@
     iObjectSource = NULL;
     
     TParsePtrC parse(aFileName);
-    const TDesC& mimeType = iDataProvider.FindMimeType(parse.Ext().Mid(1));
-    __FLOG_VA((_L16("CMtpImageDphumbnailCreator::GetThumbL() - FileName:%S, MimeType:%S"), &aFileName, &mimeType));
+    if (parse.Ext().Length() >= 1)
+        {
+        const TDesC& mimeType = iDataProvider.FindMimeType(parse.Ext().Mid(1));
+        __FLOG_VA((_L16("CMtpImageDphumbnailCreator::GetThumbL() - FileName:%S, MimeType:%S"), &aFileName, &mimeType));
     
-    iObjectSource = CThumbnailObjectSource::NewL(aFileName, mimeType);
+        iObjectSource = CThumbnailObjectSource::NewL(aFileName, mimeType);
+        }
+    else
+        {
+        iObjectSource = CThumbnailObjectSource::NewL(aFileName, KNullDesC);
+        }
     iCurrentReq = iThumbMgr->GetThumbnailL( *iObjectSource );
     iState = EGetting;
     __FLOG(_L8("<< CMtpImageDphumbnailCreator::GetThumbL()"));
--- a/mtpfws/mtpfw/bwins/mtpframeworkU.DEF	Fri Apr 16 15:51:48 2010 +0300
+++ b/mtpfws/mtpfw/bwins/mtpframeworkU.DEF	Mon May 03 13:19:02 2010 +0300
@@ -150,4 +150,7 @@
 	?SetNeedEnumeratingPhase2@CMTPDataProviderController@@QAEXH@Z @ 149 NONAME ; void CMTPDataProviderController::SetNeedEnumeratingPhase2(int)
 	?SetBTResumeParameter@CMTPConnectionMgr@@QAEXABVTBTDevAddr@@ABG@Z @ 150 NONAME ; void CMTPConnectionMgr::SetBTResumeParameter(class TBTDevAddr const &, unsigned short const &)
 	?IsReadWriteStorage@CMTPStorageMgr@@QBEHK@Z @ 151 NONAME ; int CMTPStorageMgr::IsReadWriteStorage(unsigned long) const
+	?StorageEnumerateState@CMTPDataProviderController@@QAEII@Z @ 152 NONAME ; unsigned int CMTPDataProviderController::StorageEnumerateState(unsigned int)
+	?ExecutePendingRequestL@CMTPDataProviderController@@QAEXXZ @ 153 NONAME ; void CMTPDataProviderController::ExecutePendingRequestL(void)
+	?RegisterPendingRequestDP@CMTPDataProviderController@@QAEXII@Z @ 154 NONAME ; void CMTPDataProviderController::RegisterPendingRequestDP(unsigned int, unsigned int)
 
--- a/mtpfws/mtpfw/common/inc/mtpdatacapture.h	Fri Apr 16 15:51:48 2010 +0300
+++ b/mtpfws/mtpfw/common/inc/mtpdatacapture.h	Mon May 03 13:19:02 2010 +0300
@@ -26,7 +26,7 @@
 #if defined(__WINS__)
 _LIT(KRequestCaptureRootDir, "c:\\test\\data\\");
 #elif defined(__SERIES60_) 
-_LIT(KRequestCaptureRootDir, "f:\\test\\data\\");
+_LIT(KRequestCaptureRootDir, "c:\\test\\data\\");
 #else
 _LIT(KRequestCaptureRootDir, "e:\\test\\data\\");
 #endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mtpfws/mtpfw/common/inc/uiklafinternalcrkeys.h	Mon May 03 13:19:02 2010 +0300
@@ -0,0 +1,75 @@
+/*
+* Copyright (c) 2004-2008 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Internal Central Repository keys.
+*
+*/
+
+
+#ifndef __UIKLAF_INTERNAL_CR_KEYS_H__
+#define __UIKLAF_INTERNAL_CR_KEYS_H__
+
+const TUid KCRUidUiklaf = { 0x101F8774 };
+
+// Helper constants for free disk space levels.
+#define DISK_SPACE_OK        0
+#define DISK_SPACE_WARNING  -1
+#define DISK_SPACE_CRITICAL -2
+
+/**
+ * Use KUikOODDiskFreeSpaceWarningNoteLevel instead of this!!
+ * Threshold for disk space warning level (bytes).
+ * Read-only key. Default value: 196608
+ */
+const TUint32 KUikOODDiskWarningThreshold  = 0x00000001;
+
+/**
+ * Threshold for disk space critical level (bytes).
+ * Read-only key. Default value: 131072
+ */
+const TUint32 KUikOODDiskCriticalThreshold = 0x00000002;
+
+/**
+ * Threshold for low RAM level (bytes).
+ * Read-only key. Default value: 750000
+ */
+const TUint32 KUikOOMRamLowThreshold       = 0x00000003;
+
+/**
+ * Threshold for good RAM level (bytes).
+ * Read-only key. Default value: 1000000
+ */
+const TUint32 KUikOOMRamGoodThreshold      = 0x00000004;
+
+/**
+ * Timeout for application exit (milliseconds).
+ * Read-only key. Default value: 1000000
+ */
+const TUint32 KUikOOMMaxAppExitTime        = 0x00000005;
+
+/**
+ * Threshold for disk space warning note level as percent of used disk space.
+ * Read-only key. Default value: 95
+ */
+const TUint32 KUikOODDiskFreeSpaceWarningNoteLevel = 0x00000006;
+
+/**
+ * Threshold for disk space warning note level for mass memory.
+ * Read-only key. Default value: 20971520
+ */
+const TUint32 KUikOODDiskFreeSpaceWarningNoteLevelMassMemory = 0x00000007;
+
+
+#endif __UIKLAF_INTERNAL_CR_KEYS_H__
+
+// End of file
Binary file mtpfws/mtpfw/conf/mtpframework.confml has changed
Binary file mtpfws/mtpfw/conf/mtpframework_10282fcc.crml has changed
--- a/mtpfws/mtpfw/daemon/server/group/mtpserver.mmp	Fri Apr 16 15:51:48 2010 +0300
+++ b/mtpfws/mtpfw/daemon/server/group/mtpserver.mmp	Mon May 03 13:19:02 2010 +0300
@@ -24,9 +24,9 @@
 
 #ifdef WINSCW
 //EPOCHEAPSIZE        0x1400000   0x1400000   // 20MB
-EPOCHEAPSIZE        0x80000   0x400000   // 4MB
+EPOCHEAPSIZE        0x80000   0x800000   // 8MB
 #else
-EPOCHEAPSIZE        0x80000   0x400000   // 4MB
+EPOCHEAPSIZE        0x80000   0x800000   // 8MB
 #endif
 
 MW_LAYER_SYSTEMINCLUDE_SYMBIAN
--- a/mtpfws/mtpfw/daemon/server/src/cmtpserversession.cpp	Fri Apr 16 15:51:48 2010 +0300
+++ b/mtpfws/mtpfw/daemon/server/src/cmtpserversession.cpp	Mon May 03 13:19:02 2010 +0300
@@ -132,12 +132,7 @@
     iSingletons.ConnectionMgr().SetClientSId(secureid);
     
     TInt length = aMessage.GetDesLength( 1 );
-    
-    if((!CheckIsBlueToothTransport(newUID) || (length!=0)) && (iSingletons.DpController().Count()==0))
-    	{
-    	iSingletons.DpController().LoadDataProvidersL();
-    	iSingletons.Router().ConfigureL();
-    	}
+
    
     if (length > 0)
     	{
@@ -165,6 +160,13 @@
     	aMessage.Complete(KErrNone);
     	}
     
+    // Fix TSW error MHAN-7ZU96Z
+    if((!CheckIsBlueToothTransport(newUID) || (length!=0)) && (iSingletons.DpController().Count()==0))
+    	{
+    	iSingletons.DpController().LoadDataProvidersL();
+    	iSingletons.Router().ConfigureL();
+    	}
+    
     
     __FLOG(_L8("DoStartTransportL - Exit"));
     }  
--- a/mtpfws/mtpfw/dataproviders/dataproviderapi/interface/mmtpdataproviderframework.h	Fri Apr 16 15:51:48 2010 +0300
+++ b/mtpfws/mtpfw/dataproviders/dataproviderapi/interface/mmtpdataproviderframework.h	Mon May 03 13:19:02 2010 +0300
@@ -305,7 +305,13 @@
     in the framework.
     */
     virtual void NotifyFrameworkL( TMTPNotificationToFramework aNotification, const TAny* aParams ) = 0;
-   
+    
+    /**
+    Register the current request as pending request. The pending request will be handled
+    after enumeration done.
+    */
+    virtual void RegisterPendingRequest(TUint aTimeOut = 0) = 0;
+     
     };
 
 #endif // MMTPDATAPROVIDERFRAMEWORK_H
--- a/mtpfws/mtpfw/dataproviders/devdp/group/mtpdevicedp.mmp	Fri Apr 16 15:51:48 2010 +0300
+++ b/mtpfws/mtpfw/dataproviders/devdp/group/mtpdevicedp.mmp	Mon May 03 13:19:02 2010 +0300
@@ -77,7 +77,6 @@
 LIBRARY             etel3rdparty.lib 
 LIBRARY             estor.lib 
 LIBRARY             euser.lib
-LIBRARY             hal.lib 
 LIBRARY             edbms.lib
 LIBRARY      		centralrepository.lib
 
@@ -88,4 +87,5 @@
 LIBRARY             mtpdataproviderutility.lib 
 LIBRARY             ecom.lib 
 LIBRARY             mtpdevdpextnapi.lib
+LIBRARY             sysutil.lib 
 SMPSAFE
--- a/mtpfws/mtpfw/dataproviders/devdp/inc/cmtpgetnumobjects.h	Fri Apr 16 15:51:48 2010 +0300
+++ b/mtpfws/mtpfw/dataproviders/devdp/inc/cmtpgetnumobjects.h	Mon May 03 13:19:02 2010 +0300
@@ -54,14 +54,14 @@
 
 	TBool IsSupportedFormatL(TUint32 aFormatCode);
 			
-private:
+protected:
 	/**
     FLOGGER debug trace member variable.
     */
     __FLOG_DECLARATION_MEMBER_MUTABLE;
 
+    TUint iTimeoutCount;
 	RMTPFramework iSingletons;
-protected:
     RMTPDeviceDpSingletons              iDevDpSingletons;
 	};
 	
--- a/mtpfws/mtpfw/dataproviders/devdp/inc/mtpdevicedpconst.h	Fri Apr 16 15:51:48 2010 +0300
+++ b/mtpfws/mtpfw/dataproviders/devdp/inc/mtpdevicedpconst.h	Mon May 03 13:19:02 2010 +0300
@@ -141,7 +141,6 @@
 _LIT(KMTPDefaultSerialNumber, "350149101482769");
 _LIT(KMTPDefaultManufacturer, "Symbian");
 _LIT(KMTPDefaultModel, "1234567890");
-_LIT(KMTPDefaultDeviceVersion, "1.0");
 
 /**
  *This enumerator to identify resource file prameters.
--- a/mtpfws/mtpfw/dataproviders/devdp/src/cmtpdevicedatastore.cpp	Fri Apr 16 15:51:48 2010 +0300
+++ b/mtpfws/mtpfw/dataproviders/devdp/src/cmtpdevicedatastore.cpp	Mon May 03 13:19:02 2010 +0300
@@ -15,7 +15,6 @@
 
 #include <badesca.h>
 #include <bautils.h>
-#include <hal.h>
 #include <s32file.h>
 #include  <f32file.h>
 #include <tz.h>
@@ -23,6 +22,7 @@
 #include <mtp/mtpdatatypeconstants.h>
 #include <mtp/cmtpdataproviderplugin.h>
 #include <mtp/cmtptypefile.h>
+#include <sysutil.h>
 
 #include "cmtpdataprovider.h"
 #include "cmtpdataprovidercontroller.h"
@@ -394,10 +394,25 @@
 
     case EEnumeratingDeviceVersion:
         {
-        TInt buildNo(0);
-        User::LeaveIfError(HAL::Get(HALData::EManufacturerSoftwareBuild, buildNo));
-        __FLOG_VA((_L8("EManufacturerSoftwareBuild = %d "), buildNo));
-        iDeviceVersion.Format(_L("%d"), buildNo);
+		    HBufC* verBuf = HBufC::NewLC( KSysUtilVersionTextLength );
+		    TPtr ver = verBuf->Des();
+		    SysUtil::GetSWVersion( ver );
+				
+		    // parse sw fields and append to iDeviceVersion
+		    /*
+		    "010.007\n2010-03-08\nRM-596\nNokia"
+		    */
+		    TChar separator('\n');
+		    TInt pos = ver.Locate( separator );
+		    if ( pos == KErrNotFound )
+			      {
+			      iDeviceVersion.Append( ver );
+			      }
+			  else
+			  	  {
+			  		iDeviceVersion.Append( ver.Mid( 0, pos ) );
+			  	  }
+			  CleanupStack::PopAndDestroy(verBuf);	  
         Schedule(EEnumeratingPhoneId);
         }
         break;
@@ -495,7 +510,7 @@
     iSynchronisationPartner = CMTPTypeString::NewL(*iSyncPartnerNameDefault);
 
     //  3.  Device Version.
-    iDeviceVersion.CreateL(KMTPDefaultDeviceVersion);
+    iDeviceVersion.CreateL(KSysUtilVersionTextLength);
 
     //  4.  Manufacturer.
     iPhoneIdV1.iManufacturer    = KMTPDefaultManufacturer;
--- a/mtpfws/mtpfw/dataproviders/devdp/src/cmtpdevicedp.cpp	Fri Apr 16 15:51:48 2010 +0300
+++ b/mtpfws/mtpfw/dataproviders/devdp/src/cmtpdevicedp.cpp	Mon May 03 13:19:02 2010 +0300
@@ -200,10 +200,10 @@
         iEnumeratingState = EEnumeratingDeviceDataStore;
         iStorageWatcher->Start();
         }
-    else if (iPendingEnumerations.Count() == 1)
+    else
         {
     	iEnumeratingState = EEnumeratingFolders;
-    	iEnumerator->StartL(iPendingEnumerations[KMTPDeviceDpActiveEnumeration]);
+    	NotifyEnumerationCompleteL(aStorageId, KErrNone);
         }
     __FLOG(_L8("StartObjectEnumerationL - Exit"));
     }
@@ -332,35 +332,22 @@
     __FLOG(_L8("Supported - Exit"));
     }
 
-#ifdef __FLOG_ACTIVE
-void CMTPDeviceDataProvider::NotifyEnumerationCompleteL(TUint32 aStorageId, TInt aError)
-#else
 void CMTPDeviceDataProvider::NotifyEnumerationCompleteL(TUint32 aStorageId, TInt /*aError*/)
-#endif // __FLOG_ACTIVE
 	{
     __FLOG(_L8("NotifyEnumerationCompleteL - Entry"));
     __ASSERT_DEBUG((aStorageId == iPendingEnumerations[KMTPDeviceDpActiveEnumeration]), User::Invariant());
+    if (iPendingEnumerations.Count() > 0)
+        {
+        iPendingEnumerations.Remove(KMTPDeviceDpActiveEnumeration);
+        }
 	switch(iEnumeratingState)
 		{
 	case EEnumeratingDeviceDataStore:
-		iEnumeratingState = EEnumeratingFolders;
-		iEnumerator->StartL(iPendingEnumerations[KMTPDeviceDpActiveEnumeration]);
+	case EEnumeratingFolders:
+	    iEnumeratingState = EEnumerationComplete;
+	    Framework().ObjectEnumerationCompleteL(aStorageId);
+		//iEnumerator->StartL(iPendingEnumerations[KMTPDeviceDpActiveEnumeration]);
 		break;
-
-	case EEnumeratingFolders:
-        __FLOG_VA((_L8("Enumeration of storage 0x%08X completed with error status %d"), aStorageId, aError));
-        iPendingEnumerations.Remove(KMTPDeviceDpActiveEnumeration);
-        Framework().ObjectEnumerationCompleteL(aStorageId);
-        if (iPendingEnumerations.Count() > 0)
-            {
-        	iEnumerator->StartL(iPendingEnumerations[KMTPDeviceDpActiveEnumeration]);
-            }
-        else
-            {
-    		iEnumeratingState = EEnumerationComplete;
-            }
-		break;
-
 	case EEnumerationComplete:
 	default:
 		__DEBUG_ONLY(User::Invariant());
--- a/mtpfws/mtpfw/dataproviders/devdp/src/cmtpgetdevicepropdesc.cpp	Fri Apr 16 15:51:48 2010 +0300
+++ b/mtpfws/mtpfw/dataproviders/devdp/src/cmtpgetdevicepropdesc.cpp	Mon May 03 13:19:02 2010 +0300
@@ -470,22 +470,21 @@
 
 TMTPTypeGuid* CMTPGetDevicePropDesc::GetGUIDL(const TUint aKey)
     {
-    
-    TBuf8<KMTPTypeUINT128Size> ptr;
+    TBuf<KGUIDFormatStringLength> buf;
     
-    iRepository->Get(aKey,ptr);
-    
-    TMTPTypeGuid* ret = new (ELeave) TMTPTypeGuid( ptr );
+    User::LeaveIfError(iRepository->Get(aKey,buf));
+
+    TMTPTypeGuid* ret = new (ELeave) TMTPTypeGuid( buf );
     
     return ret;
     }
 
 void CMTPGetDevicePropDesc::SaveGUID( const TUint aKey,  TMTPTypeGuid& aValue )
     {
-    TPtrC8 ptr;
-    if ( KMTPChunkSequenceCompletion == aValue.FirstReadChunk(ptr) )
-    	{
-    	iRepository->Set(aKey,ptr);
-    	}
+	TBuf<KGUIDFormatStringLength> buf;
+	if(aValue.ToString(buf) == KErrNone)
+		{
+		iRepository->Set(aKey,buf);
+		}
     }
 
--- a/mtpfws/mtpfw/dataproviders/devdp/src/cmtpgetnumobjects.cpp	Fri Apr 16 15:51:48 2010 +0300
+++ b/mtpfws/mtpfw/dataproviders/devdp/src/cmtpgetnumobjects.cpp	Mon May 03 13:19:02 2010 +0300
@@ -23,6 +23,7 @@
 #include "cmtpdataprovidercontroller.h"
 #include "cmtpdataprovider.h"
 #include "cmtpdevicedatastore.h"
+#include "cmtpdataprovidercontroller.h"
 
 #include "cmtpgetnumobjects.h"
 #include "mtpdevicedpconst.h"
@@ -30,6 +31,7 @@
 
 // Class constants.
 __FLOG_STMT(_LIT8(KComponent,"GetNumObjects");)
+static const TInt KMTPGetObjectNumTimeOut(1);
 
 /**
 Verification data for GetNumObjects request
@@ -99,33 +101,16 @@
 		return EMTPRespCodeInvalidObjectFormatCode;
 		}
 	
+	/*
 	if(iSingletons.DpController().EnumerateState() != CMTPDataProviderController::EEnumeratedFulllyCompleted)
 		{
-		TUint storageID = Request().Uint32(TMTPTypeRequest::ERequestParameter1);
 		TUint handle = Request().Uint32(TMTPTypeRequest::ERequestParameter3);
-		if(iDevDpSingletons.PendingStorages().FindInOrder(storageID) != KErrNotFound)
-			{
-			responseCode = EMTPRespCodeDeviceBusy;
-			}
-		else if( (handle != KMTPHandleNone) && (handle != KMTPHandleAll)  )
-			{
-			CMTPObjectMetaData* meta = iRequestChecker->GetObjectInfo(handle);
-			__ASSERT_DEBUG(meta, Panic(EMTPDevDpObjectNull));
-			
-			if( meta->Uint(CMTPObjectMetaData::EFormatCode) == EMTPFormatCodeAssociation )
-				{
-				responseCode = EMTPRespCodeDeviceBusy;
-				}
-			}
-		else if(EMTPFormatCodeUndefined == formatCode)
+		if(handle != KMTPHandleAll)
 			{
 			responseCode = EMTPRespCodeDeviceBusy;
 			}
 		}
-	else if(iDevDpSingletons.PendingStorages().Count() > 0)
-		{
-		iDevDpSingletons.PendingStorages().Close();
-		}
+		*/
 	
 	return responseCode;	
 	}
@@ -138,6 +123,33 @@
 	{
     __FLOG(_L8("ServiceL - Entry"));
     __FLOG_VA((_L8("IsConnectMac = %d; ERequestParameter2 = %d" ), iDevDpSingletons.DeviceDataStore().IsConnectMac(), Request().Uint32(TMTPTypeRequest::ERequestParameter2)));
+    
+    if(iSingletons.DpController().EnumerateState() != CMTPDataProviderController::EEnumeratedFulllyCompleted)
+        {
+        TUint storageId = Request().Uint32(TMTPTypeRequest::ERequestParameter1);
+        TUint handle = Request().Uint32(TMTPTypeRequest::ERequestParameter3);
+        TUint enumerateState = iSingletons.DpController().StorageEnumerateState(storageId);
+        if ( (enumerateState < CMTPDataProviderController::EEnumeratingPhaseOneDone)
+            || (enumerateState != CMTPDataProviderController::EEnumeratedFulllyCompleted && handle != KMTPHandleAll))
+            {
+            if (iTimeoutCount++ >= KMTPGetObjectNumTimeOut)
+                {
+                __FLOG(_L8("Wait for enumeration time out, return busy."));
+                SendResponseL(EMTPRespCodeDeviceBusy);
+                iTimeoutCount = 0;
+                return;
+                }
+            else
+                {
+                __FLOG(_L8("Enumeration not completed, suspend request."));
+                RegisterPendingRequest(20);
+                return; 
+                }
+            }
+        }
+    
+    iTimeoutCount = 0;
+    
 	if(iDevDpSingletons.DeviceDataStore().IsConnectMac()
         &&(KMTPFormatsAll == Request().Uint32(TMTPTypeRequest::ERequestParameter2)))
         {
--- a/mtpfws/mtpfw/dataproviders/devdp/src/cmtpgetobjecthandles.cpp	Fri Apr 16 15:51:48 2010 +0300
+++ b/mtpfws/mtpfw/dataproviders/devdp/src/cmtpgetobjecthandles.cpp	Mon May 03 13:19:02 2010 +0300
@@ -20,6 +20,7 @@
 #include <mtp/mtpdatatypeconstants.h>
 #include <mtp/mmtpstoragemgr.h>  
 
+#include "cmtpdataprovidercontroller.h"
 #include "cmtpdevicedatastore.h"
 #include "cmtpgetobjecthandles.h"
 #include "mtpdevicedpconst.h"
@@ -28,6 +29,8 @@
 // Class constants.
 __FLOG_STMT(_LIT8(KComponent,"GetObjectHandles");)
 
+static const TInt KMTPGetObjectHandlesTimeOut(1);
+
 /**
 Two-phase construction method
 @param aPlugin	The data provider plugin
@@ -77,6 +80,33 @@
 void CMTPGetObjectHandles::ServiceL()
 	{
     __FLOG(_L8("ServiceL - Entry"));
+    
+    if(iSingletons.DpController().EnumerateState() != CMTPDataProviderController::EEnumeratedFulllyCompleted)
+        {
+        TUint storageId = Request().Uint32(TMTPTypeRequest::ERequestParameter1);
+        TUint handle = Request().Uint32(TMTPTypeRequest::ERequestParameter3);
+        TUint enumerateState = iSingletons.DpController().StorageEnumerateState(storageId);
+        if ( (enumerateState < CMTPDataProviderController::EEnumeratingPhaseOneDone)
+            || (enumerateState != CMTPDataProviderController::EEnumeratedFulllyCompleted && handle != KMTPHandleAll))
+            {
+            if (iTimeoutCount++ >= KMTPGetObjectHandlesTimeOut)
+                {
+                __FLOG(_L8("Wait for enumeration time out, return busy."));
+                SendResponseL(EMTPRespCodeDeviceBusy);
+                iTimeoutCount = 0;
+                return;
+                }
+            else
+                {
+                __FLOG(_L8("Enumeration not completed, suspend request."));
+                RegisterPendingRequest(20);
+                return; 
+                }
+            }
+        }
+    
+    iTimeoutCount = 0;
+    
 	RMTPObjectMgrQueryContext   context;
 	RArray<TUint>               handles;
 	CleanupClosePushL(context);
--- a/mtpfws/mtpfw/dataproviders/devdp/src/cmtpgetstorageinfo.cpp	Fri Apr 16 15:51:48 2010 +0300
+++ b/mtpfws/mtpfw/dataproviders/devdp/src/cmtpgetstorageinfo.cpp	Mon May 03 13:19:02 2010 +0300
@@ -12,7 +12,7 @@
 //
 // Description:
 //
-
+#include <centralrepository.h>
 #include <mtp/tmtptyperequest.h>
 #include <mtp/mmtpdataproviderframework.h>
 #include <mtp/mmtpobjectmgr.h>
@@ -25,13 +25,11 @@
 #include "mtpdevdppanic.h"
 #include "rmtpdevicedpsingletons.h"
 #include "cmtpdevicedpconfigmgr.h"
+#include "mtpframeworkconst.h"
 
-//MTP should reserve some disk space to prevent ood monitor popup
-//'Out of memory' note.When syncing music through ovi suite,
-//sometimes device screen get freeze with this note
-//If you need to adjust this value,please also update the definition
-//in file 'cmtptypefile.cpp'
-const TInt KFreeSpaceThreshHoldValue(11*1024*1024);//11M
+//This file is exported from s60 sdk, now just copy it
+//to make sure onb can run
+#include "UiklafInternalCRKeys.h"
 
 // Class constants.
 __FLOG_STMT(_LIT8(KComponent,"GetStorageInfo");)
@@ -174,6 +172,7 @@
 void CMTPGetStorageInfo::SetStorageTypeL()
 	{
 	TUint16 storageType = EMTPStorageUndefined;
+	
 	switch(iDriveInfo.iType)
 		{
 		case EMediaNotPresent:
@@ -196,7 +195,14 @@
 		case EMediaFlash:					
 		case EMediaRemote:
 		case EMediaFloppy:
-			storageType = EMTPStorageRemovableRAM;
+		    if (iDriveInfo.iDriveAtt & KDriveAttRemovable)
+		        {
+		        storageType = EMTPStorageRemovableRAM;
+		        }
+		    else
+		        {
+		        storageType = EMTPStorageFixedRAM;
+		        }
 			break;
 		default:
 			break;
@@ -253,12 +259,35 @@
 	    }
 	else
 	    {
+	    CRepository* repository(NULL);
+	    TInt thresholdValue(0);
+	    TRAPD(err,repository = CRepository::NewL(KCRUidUiklaf));
+	    if (err == KErrNone)
+	        {
+	        err = repository->Get(KUikOODDiskFreeSpaceWarningNoteLevelMassMemory,thresholdValue);
+	        if (err == KErrNone)
+	            {
+	            __FLOG_1(_L8("Read from central repo:%d"),thresholdValue);
+	            thresholdValue += KFreeSpaceExtraReserved;
+	            }	  
+	        delete repository;
+	        }
+	    
+	    if (err != KErrNone)
+	        {
+	        __FLOG(_L8("Fail in read ,use default"));
+	        thresholdValue = KFreeSpaceThreshHoldDefaultValue + KFreeSpaceExtraReserved;
+	        }
+	    
+	    __FLOG_2(_L8("threshold:%d free space:%ld"),thresholdValue,iVolumeInfo.iFree);
 	    //Exclude the reserved disk space when reporting free space
-	    TInt64 free = (iVolumeInfo.iFree > KFreeSpaceThreshHoldValue) ?
-	        (iVolumeInfo.iFree - KFreeSpaceThreshHoldValue) : 0;
+	    TInt64 free = (iVolumeInfo.iFree > thresholdValue) ?
+	        (iVolumeInfo.iFree - thresholdValue) : 0;
 	    mtpFreeSpace.Set(free);
+	    __FLOG_1(_L8("set free:%ld"),free);
 	    }
-	__FLOG_2(_L8("SetFreeSpaceInBytesL volume free:%d report:%d"),
+	
+	__FLOG_2(_L8("SetFreeSpaceInBytesL volume free:%ld report:%ld"),
 	        iVolumeInfo.iFree,mtpFreeSpace.Value());
 	iStorageInfo->SetL(CMTPTypeStorageInfo::EFreeSpaceInBytes, mtpFreeSpace);	
 	}
--- a/mtpfws/mtpfw/dataproviders/devdp/src/cmtpopensession.cpp	Fri Apr 16 15:51:48 2010 +0300
+++ b/mtpfws/mtpfw/dataproviders/devdp/src/cmtpopensession.cpp	Mon May 03 13:19:02 2010 +0300
@@ -82,7 +82,12 @@
 */    
 void CMTPOpenSession::ServiceL()    
     {
-    iSingletons.DpController().WaitForEnumerationComplete();
+    if(iSingletons.DpController().EnumerateState() < CMTPDataProviderController::EEnumeratingPhaseOneDone)
+        {
+        RegisterPendingRequest();
+        return;
+        }
+    
     if(iSingletons.DpController().EnumerateState() < CMTPDataProviderController::EEnumeratingPhaseOneDone)
     	{
     	SendResponseL(EMTPRespCodeDeviceBusy);
--- a/mtpfws/mtpfw/dataproviders/devdp/src/cmtpresetdevicepropvalue.cpp	Fri Apr 16 15:51:48 2010 +0300
+++ b/mtpfws/mtpfw/dataproviders/devdp/src/cmtpresetdevicepropvalue.cpp	Mon May 03 13:19:02 2010 +0300
@@ -263,21 +263,20 @@
 
 TMTPTypeGuid* CMTPResetDevicePropValue::GetGUIDL(const TUint aKey)
     {
-    
-    TBuf8<KMTPTypeUINT128Size> ptr;
+    TBuf<KGUIDFormatStringLength> buf;
     
-    iRepository->Get(aKey,ptr);
-    
-    TMTPTypeGuid* ret = new (ELeave) TMTPTypeGuid( ptr );
+    User::LeaveIfError(iRepository->Get(aKey,buf));
+
+    TMTPTypeGuid* ret = new (ELeave) TMTPTypeGuid( buf );
     
     return ret;
     }
 
 void CMTPResetDevicePropValue::SaveGUID( const TUint aKey,  TMTPTypeGuid& aValue )
     {
-    TPtrC8 ptr;
-    if ( KMTPChunkSequenceCompletion == aValue.FirstReadChunk(ptr) )
-    	{
-    	iRepository->Set(aKey,ptr);
-    	}
+	TBuf<KGUIDFormatStringLength> buf;
+	if(aValue.ToString(buf) == KErrNone)
+		{
+		iRepository->Set(aKey,buf);
+		}
     }
--- a/mtpfws/mtpfw/dataproviders/devdp/src/mtpdevicedp_config.rss	Fri Apr 16 15:51:48 2010 +0300
+++ b/mtpfws/mtpfw/dataproviders/devdp/src/mtpdevicedp_config.rss	Mon May 03 13:19:02 2010 +0300
@@ -44,7 +44,6 @@
 		"?:\\resource",
 		"?:\\sys",
 		"?:\\system",
-		"?:\\logs",
 		"z:\\"
 		};
 	}
--- a/mtpfws/mtpfw/dataproviders/devdp/src/mtpdevicedpprocessor.cpp	Fri Apr 16 15:51:48 2010 +0300
+++ b/mtpfws/mtpfw/dataproviders/devdp/src/mtpdevicedpprocessor.cpp	Mon May 03 13:19:02 2010 +0300
@@ -51,6 +51,7 @@
 #include "cmtpgetserviceids.h"
 #include "cmtpgetserviceinfo.h"
 #include "cmtpgetformatcapabilities.h"
+#include "cmtpsetobjectprotection.h"
 /**
 device data provider mapping table from request ID to factory method of the request processor
 */
@@ -87,7 +88,8 @@
 		{EMTPOpCodeResetDevicePropValue, CMTPResetDevicePropValue::NewL},
 		{EMTPOpCodeGetServiceIDs, CMTPGetServiceIds::NewL},
 		{EMTPOpCodeGetServiceInfo, CMTPGetServiceInfo::NewL},
-		{EMTPOpCodeGetFormatCapabilities,CMTPGetFormatCapabilities::NewL}
+		{EMTPOpCodeGetFormatCapabilities,CMTPGetFormatCapabilities::NewL},
+		{EMTPOpCodeSetObjectProtection, CMTPSetObjectProtection::NewL}
 	};
 
 /**
--- a/mtpfws/mtpfw/dataproviders/dputility/bwins/mtpdataproviderutilityu.def	Fri Apr 16 15:51:48 2010 +0300
+++ b/mtpfws/mtpfw/dataproviders/dputility/bwins/mtpdataproviderutilityu.def	Mon May 03 13:19:02 2010 +0300
@@ -212,4 +212,5 @@
 	?TargetHandle@CMTPFSEntryCache@@QBEKXZ @ 211 NONAME ; unsigned long CMTPFSEntryCache::TargetHandle(void) const
 	?NewL@CMTPFSEntryCache@@SAPAV1@XZ @ 212 NONAME ; class CMTPFSEntryCache * CMTPFSEntryCache::NewL(void)
 	?FileEntry@CMTPFSEntryCache@@QAEAAVTEntry@@XZ @ 213 NONAME ; class TEntry & CMTPFSEntryCache::FileEntry(void)
+	?RegisterPendingRequest@CMTPRequestProcessor@@IAEXI@Z @ 214 NONAME ; void CMTPRequestProcessor::RegisterPendingRequest(unsigned int)
 
--- a/mtpfws/mtpfw/dataproviders/dputility/eabi/mtpdataproviderutilityu.def	Fri Apr 16 15:51:48 2010 +0300
+++ b/mtpfws/mtpfw/dataproviders/dputility/eabi/mtpdataproviderutilityu.def	Mon May 03 13:19:02 2010 +0300
@@ -414,4 +414,5 @@
 	_ZNK16RMTPDpSingletons19CopyingBigFileCacheEv @ 413 NONAME
 	_ZTI16CMTPFSEntryCache @ 414 NONAME
 	_ZTV16CMTPFSEntryCache @ 415 NONAME
+	_ZN20CMTPRequestProcessor22RegisterPendingRequestEj @ 416 NONAME
 
--- a/mtpfws/mtpfw/dataproviders/dputility/inc/cmtpfsenumerator.h	Fri Apr 16 15:51:48 2010 +0300
+++ b/mtpfws/mtpfw/dataproviders/dputility/inc/cmtpfsenumerator.h	Mon May 03 13:19:02 2010 +0300
@@ -46,7 +46,7 @@
     IMPORT_C static CMTPFSEnumerator* NewL(MMTPDataProviderFramework& aFramework, CMTPFSExclusionMgr& aExclusionMgr, MMTPEnumerationCallback& aCallback, TInt aProcessLimit);
     IMPORT_C ~CMTPFSEnumerator();
 
-	IMPORT_C void StartL(TUint32 aStorageId, TBool aOnlyRoot = EFalse);	
+	IMPORT_C void StartL(TUint32 aStorageId, TBool aScanAll = EFalse);	
 	
 private:
 	//from CActive
@@ -69,6 +69,19 @@
 	void NotifyObjectAddToDP(const TUint32 aHandle,const TUint DpId);
 	
 	
+private:
+    static  const TUint KMTPMaxFullFileName = 259;
+    class TStackItem
+        {
+        public:
+            TStackItem(const TDesC& aPath, const TUint32 aHandle):iPath(aPath), iHandle(aHandle)
+                {
+               
+                }
+        public:
+            TBuf<KMTPMaxFullFileName> iPath;
+            TUint32                   iHandle;
+        };
 private: 
 	// Owned
 	MMTPDataProviderFramework&  iFramework;
@@ -76,11 +89,11 @@
 	MMTPEnumerationCallback& 	iCallback;
 	RMTPDpSingletons			iDpSingletons;
 	TUint32 					iParentHandle;
-	TParse						iPath;
+	TBuf<KMTPMaxFullFileName>	iCurrentPath;
 	RDir						iDir;
 	TEntryArray					iEntries;
 	TInt						iFirstUnprocessed;
-	RArray<TEntry>				iDirStack;
+	RArray<TStackItem>			iDirStack;
 	RArray<TUint>				iStorages;
 	TUint32						iStorageId;
 	// How many entries should be processed in one go
@@ -89,10 +102,13 @@
 	TUint						iDpID;
 	RMTPFramework               iSingletons;
 	TBool                       iSkipCurrentStorage;
+	TBool                       iScanAll;
+	TBool                       iAllRootScaned;
+	TUint                       iScanPos;
+	TInt                        iObjectNeedToScan;
+
 	
-	TBool						iIsFileEnumerator;
-	TBool						iOnlyScanRoot;
-	TInt						iNumOfFoldersAndFiles;
+	
 	/**
     FLOGGER debug trace member variable.
     */
--- a/mtpfws/mtpfw/dataproviders/dputility/inc/cmtpmoveobject.h	Fri Apr 16 15:51:48 2010 +0300
+++ b/mtpfws/mtpfw/dataproviders/dputility/inc/cmtpmoveobject.h	Mon May 03 13:19:02 2010 +0300
@@ -24,10 +24,13 @@
 #include "rmtpframework.h"
 #include "cmtprequestprocessor.h"
 #include "mtpdebug.h"
+#include "rmtpdpsingletons.h"
 
 class CFileMan;
 class CMTPObjectMetaData;
 
+const TInt KMoveObjectTimeOut = 180000000; // 180s
+
 /** 
 Defines data provider MoveObject request processor
 
@@ -48,7 +51,9 @@
 
 private:	//from CMTPRequestProcessor
 	virtual void ServiceL();
-    TMTPResponseCode CheckRequestL();
+	TMTPResponseCode CheckRequestL();
+	TBool DoHandleCompletingPhaseL();
+	TBool Match(const TMTPTypeRequest& aRequest, MMTPConnection& aConnection) const;
 	
 private:
 	void ConstructL();
@@ -60,19 +65,26 @@
 	void SetPreviousPropertiesL(const TDesC& aFileName);
 	void MoveFileL(const TDesC& aNewFileName);
 	void MoveFolderL();
+	static TInt OnTimeoutL(TAny* aPtr);
+	void DoOnTimeoutL();
+	void RunL();
 	
 private:	
-	CFileMan*				iFileMan;
+	CFileMan*							iFileMan;
 	CMTPObjectMetaData*		iObjectInfo;	//Not owned.
-	HBufC*					iDest;
-	HBufC*					iNewRootFolder;
-	TUint32					iNewParentHandle;
-	TUint32					iStorageId;
-	TTime					iPreviousModifiedTime;
-	HBufC*					iPathToMove;
-	RArray<TUint>           iObjectHandles;
-	TInt                    iMoveObjectIndex;
-    RMTPFramework           iSingletons;
+	HBufC*								iDest;
+	HBufC*								iNewRootFolder;
+	TUint32								iNewParentHandle;
+	TUint32								iStorageId;
+	TTime									iPreviousModifiedTime;
+	HBufC*								iPathToMove;
+	RArray<TUint>					iObjectHandles;
+	TInt									iMoveObjectIndex;
+	RMTPFramework					iSingletons;
+	RMTPDpSingletons			iDpSingletons;
+	CPeriodic*						iTimer;
+	HBufC*								iNewFileName;
+	TBool									iIsFolder;
 	/**
     FLOGGER debug trace member variable.
     */
--- a/mtpfws/mtpfw/dataproviders/dputility/inc/cmtprequestprocessor.h	Fri Apr 16 15:51:48 2010 +0300
+++ b/mtpfws/mtpfw/dataproviders/dputility/inc/cmtprequestprocessor.h	Mon May 03 13:19:02 2010 +0300
@@ -139,6 +139,7 @@
 	IMPORT_C void CompleteRequestL();
 	IMPORT_C void SendDataL(const MMTPType& aData);
 	IMPORT_C void ReceiveDataL(MMTPType& aData);
+    IMPORT_C void RegisterPendingRequest(TUint aTimeOut = 0);
 		
 protected:	//	from MMTPRequestProcessor	
 	IMPORT_C virtual TBool HandleRequestL(const TMTPTypeRequest& aRequest, TMTPTransactionPhase aPhase);
--- a/mtpfws/mtpfw/dataproviders/dputility/inc/cmtpsetobjectprotection.h	Fri Apr 16 15:51:48 2010 +0300
+++ b/mtpfws/mtpfw/dataproviders/dputility/inc/cmtpsetobjectprotection.h	Mon May 03 13:19:02 2010 +0300
@@ -57,7 +57,7 @@
 private:
     RFs&                    iRfs;
     CMTPObjectMetaData*     iObjMeta;
-    
+    RMTPFramework           iSingletons;
     };
     
 #endif
--- a/mtpfws/mtpfw/dataproviders/dputility/src/cmtpcopyobject.cpp	Fri Apr 16 15:51:48 2010 +0300
+++ b/mtpfws/mtpfw/dataproviders/dputility/src/cmtpcopyobject.cpp	Mon May 03 13:19:02 2010 +0300
@@ -127,8 +127,13 @@
 	{	
 	__FLOG(_L8("ServiceL - Entry"));
 	TUint32 handle = KMTPHandleNone;
-	TMTPResponseCode responseCode = CopyObjectL(handle);
-	if(responseCode != EMTPRespCodeOK)
+	TMTPResponseCode responseCode = EMTPRespCodeOK;
+	TRAPD(err, responseCode = CopyObjectL(handle));
+	if(err != KErrNone)
+		{
+		SendResponseL(EMTPRespCodeAccessDenied);
+		}
+	else if(responseCode != EMTPRespCodeOK)
 		{
 		__FLOG_VA((_L8("ServiceL, sending response with respond code %d"), responseCode));
 		SendResponseL(responseCode);
--- a/mtpfws/mtpfw/dataproviders/dputility/src/cmtpfsenumerator.cpp	Fri Apr 16 15:51:48 2010 +0300
+++ b/mtpfws/mtpfw/dataproviders/dputility/src/cmtpfsenumerator.cpp	Mon May 03 13:19:02 2010 +0300
@@ -33,11 +33,12 @@
 // Class constants.
 __FLOG_STMT(_LIT8(KComponent,"FSEnumerator");)
 
-const TUint KMTPMaxFullFileName = 259;
 /*
  * 
  */
-#define KMAX_FILECOUNT_ENUMERATINGPHASE1 5000
+#define KMAX_FILECOUNT_ENUMERATINGPHASE1 1
+
+#define KMAX_FILECOUNT_ENUMERATINGPHASE2 0x7FFFFFFF
 
 /**
  * the files should not be owned by any dp. 
@@ -94,22 +95,29 @@
 Kick off the enumeration on the specified storage
 @param aStorageId storage to be enumerated
 */
-EXPORT_C void CMTPFSEnumerator::StartL(TUint32 aStorageId, TBool aOnlyRoot)
-	{
-	__ASSERT_DEBUG(!IsActive(), User::Invariant());
-	iNumOfFoldersAndFiles = 0;
-	iOnlyScanRoot = aOnlyRoot;
-	__FLOG_VA((_L8("iOnlyScanRoot == %d "), iOnlyScanRoot));
-	
-	MMTPStorageMgr& storageMgr(iFramework.StorageMgr());
-	if (aStorageId == KMTPStorageAll)
-	    {
+EXPORT_C void CMTPFSEnumerator::StartL(TUint32 aStorageId, TBool aScanAll)
+    {
+    __ASSERT_DEBUG(!IsActive(), User::Invariant());
+    iScanAll = aScanAll;
+    iAllRootScaned = EFalse;
+    iStorages.Reset();
+    if(iScanAll)
+        {
+        iObjectNeedToScan = KMAX_FILECOUNT_ENUMERATINGPHASE2;
+        }
+    else
+        {
+        iObjectNeedToScan = KMAX_FILECOUNT_ENUMERATINGPHASE1;
+        }
+    __FLOG_VA((_L8("iScanAll %d files %d Storage 0x%x"), iScanAll, iObjectNeedToScan, aStorageId));
+    MMTPStorageMgr& storageMgr(iFramework.StorageMgr());
+    if (aStorageId == KMTPStorageAll)
+        {
         // Retrieve the available logical StorageIDs
         RPointerArray<const CMTPStorageMetaData> storages;
         CleanupClosePushL(storages);
         TMTPStorageMgrQueryParams params(KNullDesC, CMTPStorageMetaData::ESystemTypeDefaultFileSystem);
         storageMgr.GetLogicalStoragesL(params, storages);
-        
         // Construct the StorageIDs list.
         const TUint KCount(storages.Count());
         for (TUint i(0); (i < KCount); i++)
@@ -118,72 +126,67 @@
             __FLOG_VA((_L8("FileEnumerator is doing storage id = %x\r\n"), storages[i]->Uint(CMTPStorageMetaData::EStorageId) ));
             }
         CleanupStack::PopAndDestroy(&storages);
-	    }
+        }
     else if (aStorageId != KMTPNotSpecified32)
         {
-		__ASSERT_DEBUG(storageMgr.ValidStorageId(aStorageId), User::Invariant());
-		const CMTPStorageMetaData& storage(storageMgr.StorageL(aStorageId));
-		if (storage.Uint(CMTPStorageMetaData::EStorageSystemType) == CMTPStorageMetaData::ESystemTypeDefaultFileSystem)
-		    {
-    	    if (storageMgr.LogicalStorageId(aStorageId))
-    		    {
-    		    // Logical StorageID.
-    			iStorages.AppendL(aStorageId);
-    		    }
-    		else
-    		    {
-    		    // Physical StorageID. Enumerate all eligible logical storages.
-    		    const RArray<TUint>& logicalIds(storage.UintArray(CMTPStorageMetaData::EStorageLogicalIds));
-    		    const TUint KCountLogicalIds(logicalIds.Count());
+        __ASSERT_DEBUG(storageMgr.ValidStorageId(aStorageId), User::Invariant());
+        const CMTPStorageMetaData& storage(storageMgr.StorageL(aStorageId));
+        if (storage.Uint(CMTPStorageMetaData::EStorageSystemType) == CMTPStorageMetaData::ESystemTypeDefaultFileSystem)
+            {
+            if (storageMgr.LogicalStorageId(aStorageId))
+                {
+                // Logical StorageID.
+                iStorages.AppendL(aStorageId);
+                }
+            else
+                {
+                // Physical StorageID. Enumerate all eligible logical storages.
+                const RArray<TUint>& logicalIds(storage.UintArray(CMTPStorageMetaData::EStorageLogicalIds));
+                const TUint KCountLogicalIds(logicalIds.Count());
                 for (TUint i(0); (i < KCountLogicalIds); i++)
                     {
                     iStorages.AppendL(logicalIds[i]);
                     }
-    		    }
-		    }
-		}
+                }
+            }
+        }
 
-	iStorageId = aStorageId;
-	iSkipCurrentStorage = EFalse;
+    iStorageId = aStorageId;
+    iSkipCurrentStorage = EFalse;
 	
-	if (iStorages.Count() > 0)
-		{
-		 TRAPD(err, ScanStorageL(iStorages[0]));        
-		 if(err != KErrNone)
-			 {
-			 if( !storageMgr.ValidStorageId(iStorages[0]) )
-				 {
-				 //Scan storage leave because storage(memory card) removed.
-				 //Scan next specified storage in RunL, if there is.
-				 __FLOG_VA(_L8("StartL - iSkipCurrentStorage - ETrue."));
-				 iSkipCurrentStorage = ETrue;
-				TRequestStatus* status = &iStatus;
-				User::RequestComplete(status, iStatus.Int());
-				 SetActive();
-				 }
-			 else
-				 {
-				 User::Leave(err);
-				 }
-			 }
-		}
-	else
-		{
-		if((!iIsFileEnumerator) &&(iNumOfFoldersAndFiles > KMAX_FILECOUNT_ENUMERATINGPHASE1))
-			{
-			iSingletons.DpController().SetNeedEnumeratingPhase2(ETrue);
-			}
-		
-		iCallback.NotifyEnumerationCompleteL(iStorageId, KErrNone);
-		
-		TMTPTypeEvent event;
-		
-		event.SetUint16(TMTPTypeEvent::EEventCode, EMTPEventCodeUnreportedStatus);
-		event.SetUint32(TMTPTypeEvent::EEventSessionID, KMTPSessionAll);
-		
-		iFramework.SendEventL(event);
-		}
-	}
+    if (iStorages.Count() > 0)
+        {
+        iScanPos = 0;
+        TRAPD(err, ScanStorageL(iStorages[iScanPos]));        
+        if(err != KErrNone)
+            {
+            if( !storageMgr.ValidStorageId(iStorages[iScanPos]) )
+                {
+                //Scan storage leave because storage(memory card) removed.
+                //Scan next specified storage in RunL, if there is.
+                __FLOG_VA(_L8("StartL - iSkipCurrentStorage - ETrue."));
+                iSkipCurrentStorage = ETrue;
+                TRequestStatus* status = &iStatus;
+                User::RequestComplete(status, iStatus.Int());
+                SetActive();
+                }
+            else
+                {
+                User::Leave(err);
+                }
+            }
+        }
+    else
+        {
+        iCallback.NotifyEnumerationCompleteL(iStorageId, KErrNone);
+        TMTPTypeEvent event;
+
+        event.SetUint16(TMTPTypeEvent::EEventCode, EMTPEventCodeUnreportedStatus);
+        event.SetUint32(TMTPTypeEvent::EEventSessionID, KMTPSessionAll);
+
+        iFramework.SendEventL(event);
+        }
+    }
 	
 /**
 Cancel the enumeration process
@@ -194,33 +197,33 @@
 	}
 
 void CMTPFSEnumerator::ScanStorageL(TUint32 aStorageId)
-	{
-	__FLOG_VA(_L8("ScanStorageL - entry"));
+    {
+    __FLOG_VA(_L8("ScanStorageL - entry"));
     const CMTPStorageMetaData& storage(iFramework.StorageMgr().StorageL(aStorageId));
     __ASSERT_DEBUG((storage.Uint(CMTPStorageMetaData::EStorageSystemType) == CMTPStorageMetaData::ESystemTypeDefaultFileSystem), User::Invariant());
     TFileName root(storage.DesC(CMTPStorageMetaData::EStorageSuid));
     
     #ifdef __FLOG_ACTIVE    
-	TBuf8<KMaxFileName> tmp;
-	tmp.Copy(root);
- 	__FLOG_VA((_L8("StorageSuid - %S"), &tmp));	
-	#endif // __FLOG_ACTIVE
- 	
- 	if ( iExclusionMgr.IsFolderAcceptedL(root, aStorageId) )
- 	    {
- 	    iParentHandle = KMTPHandleNoParent;
- 	    iPath.Set(root, NULL, NULL);
- 	    User::LeaveIfError(iDir.Open(iFramework.Fs(), iPath.DriveAndPath(), KEntryAttNormal | KEntryAttHidden | KEntryAttDir));
- 	    ScanDirL();
- 	    }
- 	else
- 	    {
- 	    TRequestStatus* status = &iStatus;
- 	    User::RequestComplete(status, iStatus.Int());
- 	    SetActive();
- 	    }
- 	__FLOG_VA(_L8("ScanStorageL - exit"));
-	}
+    TBuf8<KMaxFileName> tmp;
+    tmp.Copy(root);
+    __FLOG_VA((_L8("StorageSuid - %S"), &tmp));	
+    #endif // __FLOG_ACTIVE
+    
+    if ( iExclusionMgr.IsFolderAcceptedL(root, aStorageId) )
+        {
+        iParentHandle = KMTPHandleNoParent;
+        iCurrentPath = root;
+        User::LeaveIfError(iDir.Open(iFramework.Fs(), iCurrentPath, KEntryAttNormal | KEntryAttHidden | KEntryAttDir));
+        ScanDirL();
+        }
+    else
+        {
+        TRequestStatus* status = &iStatus;
+        User::RequestComplete(status, iStatus.Int());
+        SetActive();
+        }
+    __FLOG_VA(_L8("ScanStorageL - exit"));
+    }
 
 /**
 Scans directory at aPath recursing into subdirectories on a depth first basis.
@@ -252,45 +255,69 @@
 	}
 
 void CMTPFSEnumerator::ScanNextStorageL()
-	{
-	__FLOG_VA(_L8("ScanNextStorageL - entry"));
-	// If there are one or more unscanned storages left
-	// (the currently scanned one is still on the list)
-	if (iStorages.Count() > 1)
-		{
-		iStorages.Remove(0);
-		ScanStorageL(iStorages[0]);
-		}
-	else
-		{
-		// We are done
-		iStorages.Reset();
-		if((!iIsFileEnumerator) &&(iNumOfFoldersAndFiles > KMAX_FILECOUNT_ENUMERATINGPHASE1))
-			{
-			iSingletons.DpController().SetNeedEnumeratingPhase2(ETrue);
-			}
-		iCallback.NotifyEnumerationCompleteL(iStorageId, KErrNone);
-		
-		}
-	__FLOG_VA(_L8("ScanNextStorageL - exit"));
-	}
+    {
+    iDirStack.Reset();
+    __FLOG_VA(_L8("ScanNextStorageL - entry"));
+    // If there are one or more unscanned storages left
+    // (the currently scanned one is still on the list)
+    if (++ iScanPos < iStorages.Count())
+        {
+        ScanStorageL(iStorages[iScanPos]);
+        }
+    else
+        {
+        // We are done
+        iScanPos = 0;
+        
+        if(iScanAll) //all object scaned or first time limit reached.
+            {
+            iStorages.Reset();
+            if(iObjectNeedToScan <= 0)
+                {
+                iSingletons.DpController().SetNeedEnumeratingPhase2(ETrue);
+                }
+            iDir.Close();
+            iCallback.NotifyEnumerationCompleteL(iStorageId, KErrNone);
+            }
+        iAllRootScaned = ETrue;
+        if(!iScanAll)
+            {
+            if(iObjectNeedToScan > 0)//partial scan didn't finish means root didn't have KMAX_FILECOUNT_ENUMERATINGPHASE1 files
+                {
+                iScanAll = ETrue;
+                iObjectNeedToScan = KMAX_FILECOUNT_ENUMERATINGPHASE1;
+                ScanStorageL(iStorages[iScanPos]);
+                }
+            else //root has more than KMAX_FILECOUNT_ENUMERATINGPHASE1 files
+                {
+                iDir.Close();
+                iStorages.Reset();
+                iSingletons.DpController().SetNeedEnumeratingPhase2(ETrue);
+                iCallback.NotifyEnumerationCompleteL(iStorageId, KErrNone);
+                }
+            }
+        }
+    __FLOG_VA(_L8("ScanNextStorageL - exit"));
+    }
 
 void CMTPFSEnumerator::ScanNextSubdirL()
 	{
 	__FLOG_VA(_L8("ScanNextSubdirL - entry"));
 	// A empty (non-constructed) TEntry is our marker telling us to pop a directory 
 	// from iPath when we see this
-	iDirStack.AppendL(TEntry());
+	//iDirStack.AppendL(TEntry());
 			
 	// Leave with KErrNotFound if we don't find the object handle since it shouldn't be on the 
 	// dirstack if the entry wasn't added
-	TPtrC suid = iPath.DriveAndPath().Left(iPath.DriveAndPath().Length());
+	//TPtrC suid = iPath.DriveAndPath().Left(iPath.DriveAndPath().Length());
 	// Update the current parentId with object of the directory
-	iParentHandle = iFramework.ObjectMgr().HandleL(suid);
-				
+	iParentHandle = iDirStack[iDirStack.Count() - 1].iHandle;//iFramework.ObjectMgr().HandleL(suid);
+	iCurrentPath = iDirStack[iDirStack.Count() - 1].iPath;
+	iDirStack.Remove(iDirStack.Count() - 1);
+	__FLOG_VA((_L8("ScanNextSubdirL path %S"), &iCurrentPath));		
 	// Kick-off a scan of the next directory
 	iDir.Close();
-	User::LeaveIfError(iDir.Open(iFramework.Fs(), iPath.DriveAndPath(), KEntryAttNormal | KEntryAttHidden | KEntryAttDir));
+	User::LeaveIfError(iDir.Open(iFramework.Fs(), iCurrentPath, KEntryAttNormal | KEntryAttHidden | KEntryAttDir));    
 	ScanDirL();
 	__FLOG_VA(_L8("ScanNextSubdirL - exit"));
 	}
@@ -305,38 +332,15 @@
 	__FLOG_VA(_L8("ScanNextL - entry"));
 	TInt count = iDirStack.Count();
 	
-	if ((count == 0) || iOnlyScanRoot )
+	if ((count == 0) || !iScanAll)
 		{
 		// No more directories on the stack, try the next storage
 		ScanNextStorageL();
 		}
 	else
 		{
-		TEntry& entry = iDirStack[count - 1];
-		
-		// Empty TEntry, no more subdirectories in
-		// the current path
-		if (entry.iName == KNullDesC)
-			{
-			// Remove current dir from path
-			iPath.PopDir();
-			iDirStack.Remove(count - 1);
-			iDir.Close();
-			
-			// Scan the next directory of the parent
-			ScanNextL();
-			}
-			
-		// Going into a subdirectory of current
-		else 
-			{
-			// Add directory to path		
-			iPath.AddDir(entry.iName);
-			// Remove directory so we don't think it's a subdirectory
-			iDirStack.Remove(count - 1);
-	
-			ScanNextSubdirL();
-			}
+		// Remove directory so we don't think it's a subdirectory
+		ScanNextSubdirL();
 		}
 	__FLOG_VA(_L8("ScanNextL - exit"));
 	}
@@ -392,9 +396,9 @@
 TInt CMTPFSEnumerator::RunError(TInt aError)
 	{
 	__FLOG_VA((_L8("RunError - entry with error %d"), aError));
-	 if(!iFramework.StorageMgr().ValidStorageId(iStorages[0]))
+	 if(!iFramework.StorageMgr().ValidStorageId(iStorages[iScanPos]))
 		 {
-		 __FLOG_VA((_L8("Invalid StorageID = %d"),iStorages[0] ));
+		 __FLOG_VA((_L8("Invalid StorageID = %d"),iStorages[iScanPos] ));
 		 if (iStorages.Count()>1)
 			 {
 			 //Not necessary to process any entry on the storage, since the storage removed.
@@ -434,7 +438,6 @@
 	iDpSingletons.OpenL(iFramework);
 	iObject = CMTPObjectMetaData::NewL();	
 	iDpID = iFramework.DataProviderId();
-	iIsFileEnumerator = (KMTPFileDPID == iDpID);
 	}
 
 /**
@@ -442,114 +445,148 @@
 */
 
 void CMTPFSEnumerator::ProcessEntriesL()
-	{
-	TBuf<KMTPMaxFullFileName> path = iPath.DriveAndPath();
-	
-	// Start looping through entries at where we left off
-	TInt count = iEntries.Count() - iFirstUnprocessed;
-	// Process no more than KProcessLimit entries
-	count = Min(count, iProcessLimit);
-	iFirstUnprocessed += count;		
-	
-	if(!iIsFileEnumerator)
-		{
-		iNumOfFoldersAndFiles +=count;
-		}	
-	
-	for (TInt i = (iFirstUnprocessed - count); i < iFirstUnprocessed; ++i)
-		{
-		const TEntry& entry = iEntries[i];
-		path.Append(entry.iName);
-		
+    {
+    // Start looping through entries at where we left off
+    TInt count = iEntries.Count() - iFirstUnprocessed;
+    // Process no more than KProcessLimit entries
+    count = Min(count, iProcessLimit);
+    iFirstUnprocessed += count;		
+
+    for (TInt i = (iFirstUnprocessed - count); i < iFirstUnprocessed; ++i)
+        {
+        const TEntry& entry = iEntries[i];
+        iCurrentPath.Append(entry.iName);
+        __FLOG_VA((_L8("Process path %S name %S"), &iCurrentPath, &entry.iName));
 #ifdef __FLOG_ACTIVE    
-		TBuf8<KMTPMaxFullFileName> tmp;
-        tmp.Copy(path);
-        TInt pathLen=path.Length();
+        TBuf8<KMTPMaxFullFileName> tmp;
+        tmp.Copy(iCurrentPath);
+        TInt pathLen=iCurrentPath.Length();
         if(pathLen > KLogBufferSize)
             {
             TBuf8<KLogBufferSize> tmp1;
             tmp1.Copy(tmp.Ptr(),KLogBufferSize);
-			__FLOG_VA(_L8("Entry - "));
-	        __FLOG_VA((_L8("%S"), &tmp1));
+            __FLOG_VA(_L8("Entry - "));
+            __FLOG_VA((_L8("%S"), &tmp1));
 
-	        tmp1.Copy(tmp.Ptr()+KLogBufferSize, pathLen-KLogBufferSize);
-	        __FLOG_VA((_L8("%S"), &tmp1));
+            tmp1.Copy(tmp.Ptr()+KLogBufferSize, pathLen-KLogBufferSize);
+            __FLOG_VA((_L8("%S"), &tmp1));
             }
         else
             {
             __FLOG_VA(_L8("Entry - "));
-			__FLOG_VA((_L8("%S"), &tmp));
+            __FLOG_VA((_L8("%S"), &tmp));
             }
 #endif // __FLOG_ACTIVE
-		
-		TInt len = entry.iName.Length();
-		TInt totalLen = path.Length();
-		if(totalLen > KMaxFileName)
-		    {
-			// Remove filename part
-		    path.SetLength(totalLen - len);
-		    __FLOG_VA(_L8("Full name exceeds KMaxFileName, ignored."));
-		    continue;
-		    }
-		TUint32 handle = 0;
-		TMTPFormatCode format;
-		  TParsePtrC parse(path);
-		if (entry.IsDir())
-			{
-			if (iExclusionMgr.IsFolderAcceptedL(path, iStorages[0]))
-				{
-				path.Append('\\');
-				++len;
-				format = EMTPFormatCodeAssociation;
-				AddEntryL(path, handle, format, iDpID, entry, iStorages[0], iParentHandle);
-				iDirStack.AppendL(entry);
-				}
-			}
-		else if ( iExclusionMgr.IsFileAcceptedL(path,iStorages[0]) )
-			{
-			format = EMTPFormatCodeUndefined;
-			AddEntryL(path, handle, format, iDpID, entry, iStorages[0], iParentHandle);
-			}
-		else if ( parse.ExtPresent() )
-		    {
-		    switch(iDpSingletons.MTPUtility().GetEnumerationFlag(parse.Ext().Mid(1)))
-		        {
-            case MISSED_FILES_OWNED_BY_FILE_DP:
-                if (KMTPHandleNone == iFramework.ObjectMgr().HandleL(path))
+
+        TInt len = entry.iName.Length();
+        TInt totalLen = iCurrentPath.Length();
+        if(totalLen > KMaxFileName)
+            {
+            // Remove filename part
+            iCurrentPath.SetLength(totalLen - len);
+            __FLOG_VA(_L8("Full name exceeds KMaxFileName, ignored."));
+            continue;
+            }
+        TUint32 handle = 0;
+        TMTPFormatCode format;
+        if(-- iObjectNeedToScan <=0 && iAllRootScaned)
+            {
+            iSkipCurrentStorage = ETrue;
+            return;
+            }
+        if (entry.IsDir())
+            {
+            if (iExclusionMgr.IsFolderAcceptedL(iCurrentPath, iStorages[iScanPos]))
+                {
+                iCurrentPath.Append('\\');
+                ++len;
+                format = EMTPFormatCodeAssociation;
+                AddEntryL(iCurrentPath, handle, format, KMTPDeviceDPID, entry, iStorages[iScanPos], iParentHandle);
+                iDirStack.Append(TStackItem(iCurrentPath, handle));
+                }
+            }
+        else
+            {
+            if ( iExclusionMgr.IsFileAcceptedL(iCurrentPath,iStorages[iScanPos]) )
+                {
+                format = EMTPFormatCodeUndefined;
+                AddEntryL(iCurrentPath, handle, format, iDpID, entry, iStorages[iScanPos], iParentHandle);
+                }
+            else 
+                {
+                    TParsePtrC parse(iCurrentPath);
+                    if ( parse.ExtPresent() )
                     {
-                    format = EMTPFormatCodeUndefined;
-                    AddEntryL(path, handle, format, iDpID, entry, iStorages[0], iParentHandle);		   
-                    }
-                break;
-                
-            case MISSED_FILES_OWNED_BY_OTHER_DP:
-                if (KMTPHandleNone == iFramework.ObjectMgr().HandleL(path))
-                    {
-                    format = iDpSingletons.MTPUtility().GetFormatByExtension(parse.Ext().Mid(1));  
-                    TUint32 DpId = iDpSingletons.MTPUtility().GetDpId(parse.Ext().Mid(1), KNullDesC);
-                    AddFileEntryForOtherDpL(path, handle, format, DpId, entry, iStorages[0], iParentHandle);
+                    switch(iDpSingletons.MTPUtility().GetEnumerationFlag(parse.Ext().Mid(1)))
+                        {
+                    case MISSED_FILES_OWNED_BY_FILE_DP:
+                        if (KMTPHandleNone == iFramework.ObjectMgr().HandleL(iCurrentPath))
+                            {
+                            format = EMTPFormatCodeUndefined;
+                            AddEntryL(iCurrentPath, handle, format, iDpID, entry, iStorages[iScanPos], iParentHandle);		   
+                            }
+                        break;
+                        
+                    case MISSED_FILES_OWNED_BY_OTHER_DP:
+                        if (KMTPHandleNone == iFramework.ObjectMgr().HandleL(iCurrentPath))
+                            {
+                            format = iDpSingletons.MTPUtility().GetFormatByExtension(parse.Ext().Mid(1));  
+                            TUint32 DpId = iDpSingletons.MTPUtility().GetDpId(parse.Ext().Mid(1), KNullDesC);
+                            AddFileEntryForOtherDpL(iCurrentPath, handle, format, DpId, entry, iStorages[iScanPos], iParentHandle);
+                            }
+                        break;
+                        
+                    case FILES_OWNED_BY_OTHER_DP:
+                        {
+                        _LIT( KTxtExtensionODF, ".odf" );
+                        TUint32 DpId = iFramework.DataProviderId();
+                        if (parse.Ext().CompareF(KTxtExtensionODF)==0)
+                            {
+                            format = iDpSingletons.MTPUtility().FormatFromFilename(parse.Ext().Mid(1));
+                            if ( EMTPFormatCode3GPContainer==format || EMTPFormatCodeMP4Container==format )
+                                {
+                                DpId = iDpSingletons.MTPUtility().GetDpId(parse.Ext().Mid(1),KNullDesC);
+                                if ( 255 == DpId )
+                                    {
+                                    HBufC* mime = NULL;
+                                    mime = iDpSingletons.MTPUtility().ContainerMimeType(iCurrentPath);
+                                    if ( mime != NULL )
+                                        {
+                                        DpId = iDpSingletons.MTPUtility().GetDpId(parse.Ext().Mid(1),*mime);
+                                        delete mime;
+                                        mime = NULL;
+                                        }
+                                    }
+                                AddFileEntryForOtherDpL(iCurrentPath, handle, format, DpId, entry, iStorages[iScanPos], iParentHandle);
+                                }
+                            else
+                                {
+                                format = EMTPFormatCodeUndefined;
+                                AddEntryL(iCurrentPath, handle, format, iDpID, entry, iStorages[iScanPos], iParentHandle);
+                                }
+                            }
+                        else
+                            {
+                            format = iDpSingletons.MTPUtility().GetFormatByExtension(parse.Ext().Mid(1));  
+                            TUint32 DpId = iDpSingletons.MTPUtility().GetDpId(parse.Ext().Mid(1), KNullDesC);
+                            AddFileEntryForOtherDpL(iCurrentPath, handle, format, DpId, entry, iStorages[iScanPos], iParentHandle);
+                            }
+                        }
+                        break;
+                        
+        //          case FILES_OWNED_BY_NONE:
+                    default:
+                        //nothing to do
+                        break;
+                        }    
                     }
-                break;
-                
-            case FILES_OWNED_BY_OTHER_DP:
-                {
-                format = iDpSingletons.MTPUtility().GetFormatByExtension(parse.Ext().Mid(1));  
-                TUint32 DpId = iDpSingletons.MTPUtility().GetDpId(parse.Ext().Mid(1), KNullDesC);
-                AddFileEntryForOtherDpL(path, handle, format, DpId, entry, iStorages[0], iParentHandle);
                 }
-                break;
-                
-//          case FILES_OWNED_BY_NONE:
-            default:
-                //nothing to do
-                break;
-		        }    
-		    }
-		// Remove filename part					
-		path.SetLength(path.Length() - len);
-		}
-		
-	}
+            }
+        // Remove filename part					
+        iCurrentPath.SetLength(iCurrentPath.Length() - len);
+        }
+    
+    }
 
 /**
 Add a file entry to the object store
@@ -574,14 +611,14 @@
         TParsePtrC pathParser(aPath.Left(aPath.Length() - 1)); // Ignore the trailing "\".
 		name.Set(aEntry.iName);
         }
-    else
+    else 
         {
         assoc = EMTPAssociationTypeUndefined;
         TParsePtrC pathParser(aPath);
 		name.Set(pathParser.Name());	
         }
     
-    if(iExclusionMgr.IsFormatValid(format))
+    //if(iExclusionMgr.IsFormatValid(format))
         {
         aHandle = KMTPHandleNone;
         
@@ -594,6 +631,8 @@
         iObject->SetUint(CMTPObjectMetaData::ENonConsumable, EMTPConsumable);
         iObject->SetDesCL(CMTPObjectMetaData::EName, name);
         iFramework.ObjectMgr().InsertObjectL(*iObject);
+        aHandle = iObject->Uint(CMTPObjectMetaData::EHandle);
+        
         }
 	__FLOG_VA(_L8("AddEntryL - exit"));	
 	}
--- a/mtpfws/mtpfw/dataproviders/dputility/src/cmtpmoveobject.cpp	Fri Apr 16 15:51:48 2010 +0300
+++ b/mtpfws/mtpfw/dataproviders/dputility/src/cmtpmoveobject.cpp	Mon May 03 13:19:02 2010 +0300
@@ -23,6 +23,7 @@
 #include <mtp/cmtptypearray.h>
 #include <mtp/cmtptypestring.h>
 
+#include "cmtpfsentrycache.h"
 #include "cmtpstoragemgr.h"
 #include "cmtpmoveobject.h"
 #include "mtpdppanic.h"
@@ -61,12 +62,17 @@
 Destructor
 */	
 EXPORT_C CMTPMoveObject::~CMTPMoveObject()
-	{	
+	{
+	Cancel();
+	iDpSingletons.Close();
+	iSingletons.Close();
+	
+	delete iTimer;
+	delete iNewFileName;
 	delete iDest;
 	delete iFileMan;
 	delete iPathToMove;
-	delete iNewRootFolder;
-	iSingletons.Close();
+	delete iNewRootFolder;	
 	__FLOG_CLOSE;
 	}
 
@@ -75,7 +81,7 @@
 */	
 CMTPMoveObject::CMTPMoveObject(MMTPDataProviderFramework& aFramework, MMTPConnection& aConnection) :
 	CMTPRequestProcessor(aFramework, aConnection, sizeof(KMTPMoveObjectPolicy)/sizeof(TMTPRequestElementInfo), KMTPMoveObjectPolicy),
-	iMoveObjectIndex(0)
+	iMoveObjectIndex(0), iTimer(NULL)
 	{
 	__FLOG_OPEN(KMTPSubsystem, KComponent);
 	}
@@ -104,6 +110,21 @@
 		result = EMTPRespCodeStoreReadOnly;
 		}
 	
+	if(result == EMTPRespCodeOK)
+		{
+		const TDesC& suid(iObjectInfo->DesC(CMTPObjectMetaData::ESuid));
+		iIsFolder = EFalse;
+		User::LeaveIfError(BaflUtils::IsFolder(iFramework.Fs(), suid, iIsFolder));
+		if(!iIsFolder)
+			{
+			if(iDpSingletons.MovingBigFileCache().IsOnGoing())
+				{
+				__FLOG(_L8("CheckRequestL - A big file moving is ongoing, respond with access denied"));
+				result = EMTPRespCodeAccessDenied;
+				}
+			}
+		}
+	
     __FLOG(_L8("CheckRequestL - Exit"));
 	return result;	
 	} 
@@ -112,7 +133,8 @@
 MoveObject request handler
 */		
 void CMTPMoveObject::ServiceL()
-	{	
+	{
+	__FLOG(_L8("ServiceL - Entry"));
 	TMTPResponseCode ret = EMTPRespCodeOK;
 	TRAPD(err, ret = MoveObjectL());
 	if (err != KErrNone)
@@ -123,6 +145,7 @@
 		{
 		SendResponseL(ret);
 		}
+	__FLOG(_L8("ServiceL - Exit"));
 	}
 
 /**
@@ -131,6 +154,7 @@
 void CMTPMoveObject::ConstructL()
     {
 	iSingletons.OpenL();
+	iDpSingletons.OpenL(iFramework);
     }
     
 
@@ -143,12 +167,38 @@
 	__FLOG(_L8("MoveFileL - Entry"));
 	const TDesC& suid(iObjectInfo->DesC(CMTPObjectMetaData::ESuid));
 	GetPreviousPropertiesL(suid);
-	User::LeaveIfError(iFileMan->Move(suid, *iDest));
-	SetPreviousPropertiesL(aNewFileName);
-	iObjectInfo->SetDesCL(CMTPObjectMetaData::ESuid, aNewFileName);
-	iObjectInfo->SetUint(CMTPObjectMetaData::EStorageId, iStorageId);
-	iObjectInfo->SetUint(CMTPObjectMetaData::EParentHandle, iNewParentHandle);
-	iFramework.ObjectMgr().ModifyObjectL(*iObjectInfo);
+	
+	if(iFramework.StorageMgr().DriveNumber(iObjectInfo->Uint(CMTPObjectMetaData::EStorageId)) ==
+			iFramework.StorageMgr().DriveNumber(iStorageId))
+		//Move file to the same storage
+		{
+		User::LeaveIfError(iFileMan->Move(suid, *iDest));
+		SetPreviousPropertiesL(aNewFileName);
+		iObjectInfo->SetDesCL(CMTPObjectMetaData::ESuid, aNewFileName);
+		iObjectInfo->SetUint(CMTPObjectMetaData::EStorageId, iStorageId);
+		iObjectInfo->SetUint(CMTPObjectMetaData::EParentHandle, iNewParentHandle);
+		iFramework.ObjectMgr().ModifyObjectL(*iObjectInfo);
+		SendResponseL(EMTPRespCodeOK);
+		}
+	else
+		//Move file between different storages
+		{
+		delete iNewFileName;
+		iNewFileName = NULL;
+		iNewFileName = aNewFileName.AllocL(); // Store the new file name
+		
+		User::LeaveIfError(iFileMan->Move(suid, *iDest, CFileMan::EOverWrite, iStatus));
+		if ( !IsActive() )
+		{  
+		SetActive();
+		}
+		
+		delete iTimer;
+		iTimer = NULL;
+		iTimer = CPeriodic::NewL(EPriorityStandard);
+		TTimeIntervalMicroSeconds32 KMoveObjectIntervalNone = 0;	
+		iTimer->Start(TTimeIntervalMicroSeconds32(KMoveObjectTimeOut), KMoveObjectIntervalNone, TCallBack(CMTPMoveObject::OnTimeoutL, this));		
+		}
 	__FLOG(_L8("MoveFileL - Exit"));
 	}
 
@@ -206,10 +256,7 @@
 	TParsePtrC fileNameParser(suid);
 	
 	// Check if the object is a folder or a file.
-	TBool isFolder = EFalse;
-	User::LeaveIfError(BaflUtils::IsFolder(iFramework.Fs(), suid, isFolder));	
-				
-	if(!isFolder)
+	if(!iIsFolder)
 		{
 		if((newObjectName.Length() + fileNameParser.NameAndExt().Length()) <= newObjectName.MaxLength())
 			{
@@ -239,10 +286,9 @@
 		iFileMan = NULL;
 		iFileMan = CFileMan::NewL(iFramework.Fs());
 		
-		if(!isFolder)
+		if(!iIsFolder)
 			{
 			MoveFileL(newObjectName);
-			SendResponseL(responseCode);
 			}
 		else
 			{		
@@ -347,7 +393,129 @@
 	__FLOG(_L8("SetPreviousPropertiesL - Exit"));
 	}
 
+/**
+ Call back function, called when the timer expired for big file moving.
+ Send response to initiator and cache the target file entry info, which is used to send response 
+ to getobjectproplist and getobjectinfo.
+*/
+TInt CMTPMoveObject::OnTimeoutL(TAny* aPtr)
+	{
+	CMTPMoveObject* moveObjectProcessor = static_cast<CMTPMoveObject*>(aPtr);
+	moveObjectProcessor->DoOnTimeoutL();
+	return KErrNone;
+	}
 
+void CMTPMoveObject::DoOnTimeoutL()
+	{
+	__FLOG(_L8("DoOnTimeoutL - Entry"));
+	
+	if (iTimer)
+		{
+		if (iTimer->IsActive())
+			{
+			iTimer->Cancel();
+			}
+		delete iTimer;
+		iTimer = NULL;
+		}
+	
+	const TDesC& suid(iObjectInfo->DesC(CMTPObjectMetaData::ESuid));
+	TEntry fileEntry;
+	User::LeaveIfError(iFramework.Fs().Entry(suid, fileEntry));
+	TUint32 handle = iObjectInfo->Uint(CMTPObjectMetaData::EHandle);
+	
+	iObjectInfo->SetDesCL(CMTPObjectMetaData::ESuid, *iNewFileName);
+	iObjectInfo->SetUint(CMTPObjectMetaData::EStorageId, iStorageId);
+	iObjectInfo->SetUint(CMTPObjectMetaData::EParentHandle, iNewParentHandle);
+	iFramework.ObjectMgr().ModifyObjectL(*iObjectInfo);
+	
+	CMTPFSEntryCache& aCache = iDpSingletons.MovingBigFileCache();
+	
+	// Cache the target file entry info, which is used to send response to getobjectproplist and getobjectinfo
+	aCache.SetOnGoing(ETrue);
+	aCache.SetTargetHandle(handle);
+	aCache.SetFileEntry(fileEntry);	
+	
+	__FLOG(_L8("UpdateFSEntryCache, sending response with respond code OK for a big file move"));
+	SendResponseL(EMTPRespCodeOK);
+	
+	__FLOG(_L8("DoOnTimeoutL - Exit"));
+	}
 
+/**
+ CMTPMoveObject::RunL
+*/
+void CMTPMoveObject::RunL()
+	{
+	__FLOG(_L8("RunL - Entry"));
+	
+	User::LeaveIfError(iStatus.Int());
+	SetPreviousPropertiesL(*iNewFileName);
+	CMTPFSEntryCache& aCache = iDpSingletons.MovingBigFileCache();
+	// Check to see if we are moving a big file
+	if(aCache.IsOnGoing())
+		{
+		__FLOG(_L8("RunL - Big file move complete"));
+		aCache.SetOnGoing(EFalse);
+		aCache.SetTargetHandle(KMTPHandleNone);
+		}
+	else
+		{
+		//Cancel the timer
+		if(iTimer)
+			{
+			if(iTimer->IsActive())
+				{
+				iTimer->Cancel();
+				}
+			delete iTimer;
+			iTimer = NULL;
+			}
 
+		iObjectInfo->SetDesCL(CMTPObjectMetaData::ESuid, *iNewFileName);
+		iObjectInfo->SetUint(CMTPObjectMetaData::EStorageId, iStorageId);
+		iObjectInfo->SetUint(CMTPObjectMetaData::EParentHandle, iNewParentHandle);
+		iFramework.ObjectMgr().ModifyObjectL(*iObjectInfo);
 
+		__FLOG(_L8("RunL, sending response with respond code OK for a normal file move"));
+		SendResponseL(EMTPRespCodeOK);
+		}
+	__FLOG(_L8("RunL - Exit"));
+	}
+
+/**
+Override to handle the complete phase of move object
+*/
+TBool CMTPMoveObject::DoHandleCompletingPhaseL()
+	{
+	CMTPRequestProcessor::DoHandleCompletingPhaseL();
+	
+	CMTPFSEntryCache& aCache = iDpSingletons.MovingBigFileCache();
+	if(aCache.IsOnGoing())
+		{
+		return EFalse;
+		}
+	else
+		{
+		return ETrue;
+		}
+	}
+
+/**
+Override to match MoveObject request
+@param aRequest    The request to match
+@param aConnection The connection from which the request comes
+@return ETrue if the processor can handle the request, otherwise EFalse
+*/        
+TBool CMTPMoveObject::Match(const TMTPTypeRequest& aRequest, MMTPConnection& aConnection) const
+	{
+	__FLOG(_L8("Match - Entry"));
+	TBool result = EFalse;
+	TUint16 operationCode = aRequest.Uint16(TMTPTypeRequest::ERequestOperationCode);
+	if ((operationCode == EMTPOpCodeMoveObject) && &iConnection == &aConnection)
+	{
+	result = ETrue;
+	}    
+	__FLOG_VA((_L8("Match -- Exit with result = %d"), result));
+	return result;
+	}
--- a/mtpfws/mtpfw/dataproviders/dputility/src/cmtprequestprocessor.cpp	Fri Apr 16 15:51:48 2010 +0300
+++ b/mtpfws/mtpfw/dataproviders/dputility/src/cmtprequestprocessor.cpp	Mon May 03 13:19:02 2010 +0300
@@ -22,7 +22,6 @@
 
 #include "cmtprequestprocessor.h"
 #include "cmtprequestchecker.h"
-
 const static TInt KNullBufferSize = 4096;
 __FLOG_STMT(_LIT8(KComponent,"MTPRequestProcessor");)
 
@@ -75,31 +74,19 @@
 @param aParmas	The pointer to array of parameters
 */	
 EXPORT_C void CMTPRequestProcessor::SendResponseL(TMTPResponseCode aResponseCode, TInt aParameterCount, TUint32* aParams)
-	{
-	__ASSERT_DEBUG(aParameterCount < TMTPTypeRequest::ENumElements, User::Invariant());
-    
-	iResponse.SetUint16(TMTPTypeResponse::EResponseCode, aResponseCode);
-		    
+    {
+    __ASSERT_DEBUG(aParameterCount < TMTPTypeRequest::ENumElements, User::Invariant());
+    iResponse.Reset();
+    iResponse.SetUint16(TMTPTypeResponse::EResponseCode, aResponseCode);
     iResponse.SetUint32(TMTPTypeResponse::EResponseSessionID, iSessionId);
-	
-	iResponse.SetUint32(TMTPTypeResponse::EResponseTransactionID, iTransactionCode);
-   
-    TInt i = 0;	
-	for(i = 0; i < aParameterCount; i++)
-		{
-		iResponse.SetUint32(TMTPTypeResponse::EResponseParameter1 + i, aParams[i]);
-		}
-
-	i += TMTPTypeResponse::EResponseParameter1;
-	while(i <= TMTPTypeResponse::EResponseParameter5)
-	    {
-	    iResponse.SetUint32(i, KMTPNotSpecified32);
-	    i++;
-	    }
-
-	__ASSERT_DEBUG(iRequest, User::Invariant()); 
-	iFramework.SendResponseL(iResponse, *iRequest, iConnection);
-	}
+    iResponse.SetUint32(TMTPTypeResponse::EResponseTransactionID, iTransactionCode);
+    for(TInt i = 0; i < aParameterCount; ++ i)
+        {
+        iResponse.SetUint32(TMTPTypeResponse::EResponseParameter1 + i, aParams[i]);
+        }
+    __ASSERT_DEBUG(iRequest, User::Invariant());
+    iFramework.SendResponseL(iResponse, *iRequest, iConnection);
+    }
 
 /**
 The current active request
@@ -157,6 +144,14 @@
 	}
 	
 /**
+Register self as a pending request
+*/
+EXPORT_C void CMTPRequestProcessor::RegisterPendingRequest(TUint aTimeOut)
+    {
+    iFramework.RegisterPendingRequest(aTimeOut);
+    }
+
+/**
 Handle the request
 @param aRequest	The request to be processed
 @param aPhase	The current transaction phase of the request
--- a/mtpfws/mtpfw/dataproviders/dputility/src/cmtpsetobjectpropvalue.cpp	Fri Apr 16 15:51:48 2010 +0300
+++ b/mtpfws/mtpfw/dataproviders/dputility/src/cmtpsetobjectpropvalue.cpp	Mon May 03 13:19:02 2010 +0300
@@ -28,6 +28,7 @@
 #include "mtpframeworkconst.h"
 #include "rmtpdpsingletons.h"
 #include "rmtputility.h"
+#include "cmtpstoragemgr.h"
 
 /**
 Verification data for the SetObjectPropValue request
@@ -109,6 +110,11 @@
     CMTPObjectMetaData* meta = iRequestChecker->GetObjectInfo(handle);
     __ASSERT_DEBUG(meta, Panic(EMTPDpObjectNull));
     
+    if(!iSingleton.StorageMgr().IsReadWriteStorage(meta->Uint(CMTPObjectMetaData::EStorageId)))
+   		{
+		responseCode = EMTPRespCodeAccessDenied;
+   		}
+    
 	if(responseCode == EMTPRespCodeOK)
 		{
 		TUint32 propCode = Request().Uint32(TMTPTypeRequest::ERequestParameter2);
--- a/mtpfws/mtpfw/dataproviders/dputility/src/cmtpsetobjectprotection.cpp	Fri Apr 16 15:51:48 2010 +0300
+++ b/mtpfws/mtpfw/dataproviders/dputility/src/cmtpsetobjectprotection.cpp	Mon May 03 13:19:02 2010 +0300
@@ -28,6 +28,7 @@
 #include "mtpframeworkconst.h"
 #include "rmtpdpsingletons.h"
 #include "rmtputility.h"
+#include "cmtpstoragemgr.h"
 
 /**
 Verification data for the SetObjectPropValue request
@@ -37,6 +38,8 @@
         {TMTPTypeRequest::ERequestParameter1, EMTPElementTypeObjectHandle, EMTPElementAttrWrite, 0, 0, 0},      
      };
 
+const TInt KRetryTimes = 10;
+const TInt KRetryInterval = 150 * 1000; //150ms
 /**
 Two-phase construction method
 @param aPlugin  The data provider plugin
@@ -61,6 +64,7 @@
 EXPORT_C CMTPSetObjectProtection::~CMTPSetObjectProtection()
     {   
     delete iObjMeta;
+    iSingletons.Close();
     }
 
 /**
@@ -83,6 +87,11 @@
         {
         return EMTPRespCodeInvalidObjectHandle;
         }
+    if(!iSingletons.StorageMgr().IsReadWriteStorage(iObjMeta->Uint(CMTPObjectMetaData::EStorageId)))
+		{
+		return EMTPRespCodeAccessDenied; //EMTPRespCodeStoreReadOnly
+		}
+    
     TUint32 statusValue = Request().Uint32(TMTPTypeRequest::ERequestParameter2);
     //Currently we only support EMTPProtectionNoProtection and EMTPProtectionReadOnly
     if ( statusValue!=EMTPProtectionNoProtection && statusValue!=EMTPProtectionReadOnly )
@@ -97,20 +106,42 @@
     {
     TUint32 handle = Request().Uint32(TMTPTypeRequest::ERequestParameter1);
     TUint32 statusValue = Request().Uint32(TMTPTypeRequest::ERequestParameter2);
-    TMTPResponseCode rsp = EMTPRespCodeOK;
+    TMTPResponseCode rsp = EMTPRespCodeAccessDenied;
     //iFramework.ObjectMgr().ObjectL(TMTPTypeUint32(handle), *iObjMeta);
     
     switch(statusValue)
         {
         case EMTPProtectionNoProtection:
             {
-            iRfs.SetAtt(iObjMeta->DesC(CMTPObjectMetaData::ESuid),KEntryAttNormal,KEntryAttReadOnly);
+            for(TInt i = 0; i < KRetryTimes; ++ i)
+                {
+                if(KErrNone == iRfs.SetAtt(iObjMeta->DesC(CMTPObjectMetaData::ESuid),KEntryAttNormal,KEntryAttReadOnly))
+                    {
+                    rsp = EMTPRespCodeOK;
+                    break;
+                    }
+                else
+                    {
+                    User::After(KRetryInterval);	
+                    }
+                }
             }
             break;
         case EMTPProtectionReadOnly:
         case EMTPProtectionReadOnlyData:
             {
-            iRfs.SetAtt(iObjMeta->DesC(CMTPObjectMetaData::ESuid),KEntryAttReadOnly,KEntryAttNormal);
+            for(TInt i = 0; i < KRetryTimes; ++ i)
+                {
+                if(KErrNone == iRfs.SetAtt(iObjMeta->DesC(CMTPObjectMetaData::ESuid),KEntryAttReadOnly,KEntryAttNormal))
+                    {
+                        rsp = EMTPRespCodeOK;
+                        break;
+                    }
+                    else
+                    {
+                        User::After(KRetryInterval);	
+                    }
+                }
             }
             break;
         default:
@@ -127,4 +158,5 @@
 void CMTPSetObjectProtection::ConstructL()
     {   
     iObjMeta = CMTPObjectMetaData::NewL();
+    iSingletons.OpenL();
     }
--- a/mtpfws/mtpfw/dataproviders/proxydp/src/cmtpdeleteobject.cpp	Fri Apr 16 15:51:48 2010 +0300
+++ b/mtpfws/mtpfw/dataproviders/proxydp/src/cmtpdeleteobject.cpp	Mon May 03 13:19:02 2010 +0300
@@ -19,6 +19,7 @@
 #include <mtp/mtpprotocolconstants.h>
 #include <mtp/tmtptyperequest.h>
 #include <mtp/cmtptypearray.h>
+#include <mtp/mtpdataproviderapitypes.h>
 
 #include "cmtpdataprovider.h"
 #include "cmtpdataprovidercontroller.h"
@@ -98,10 +99,6 @@
 	{
     __FLOG(_L8("CheckRequestL - Entry"));
     TMTPResponseCode responseCode = CMTPRequestProcessor::CheckRequestL();   
-    if ((EMTPRespCodeOK == responseCode) && (iSingletons.DpController().EnumerateState() == CMTPDataProviderController::EEnumeratingSubDirFiles))
-        {
-		responseCode = EMTPRespCodeDeviceBusy;
-        }
     
 	__FLOG_VA((_L8("CheckRequestL - Exit with responseCode = 0x%04X"), responseCode));
     return responseCode;
@@ -119,6 +116,27 @@
     router.ParseOperationRequestL(params);
     router.RouteOperationRequestL(params, iTargetDps);
     
+    if (iSingletons.DpController().EnumerateState() == CMTPDataProviderController::EEnumeratingSubDirFiles)
+        {
+		TBool hasBaseFileSystemDp = EFalse;
+		for(TInt i=0; i<iTargetDps.Count(); i++)
+			{
+			CMTPDataProvider& dp = iSingletons.DpController().DataProviderL( iTargetDps[i] );
+			if(dp.SupportedCodes(EStorageSystemTypes).Find(CMTPStorageMetaData::ESystemTypeDefaultFileSystem) != KErrNotFound)
+				{
+				hasBaseFileSystemDp = ETrue;
+				break;
+				}
+			}
+		
+		if(hasBaseFileSystemDp)
+			{
+			SendResponseL(EMTPRespCodeDeviceBusy);
+			__FLOG( _L8("-ServiceL with Device_Busy") );
+			return;
+			}
+        }
+    
     BrowseHandlesL();
     
     __FLOG( _L8("-ServiceL") );
--- a/mtpfws/mtpfw/dataproviders/proxydp/src/cmtpgetobjectproplist.cpp	Fri Apr 16 15:51:48 2010 +0300
+++ b/mtpfws/mtpfw/dataproviders/proxydp/src/cmtpgetobjectproplist.cpp	Mon May 03 13:19:02 2010 +0300
@@ -77,6 +77,19 @@
 */	
 void CMTPGetObjectPropList::ServiceL()
     {
+    if(iSingletons.DpController().EnumerateState() != CMTPDataProviderController::EEnumeratedFulllyCompleted)
+        {
+        TUint32 handle = Request().Uint32( TMTPTypeRequest::ERequestParameter1 );
+        TUint32 depth = Request().Uint32( TMTPTypeRequest::ERequestParameter5 );  
+        if (depth > 0)
+            {
+            if (handle != KMTPHandleNone || depth != 1)
+                {
+                RegisterPendingRequest();
+                return;
+                }
+            }
+        }
     iTargetDps.Reset();
     CMTPParserRouter& router(iSingletons.Router());
     CMTPParserRouter::TRoutingParameters params(Request(), iConnection);
--- a/mtpfws/mtpfw/dataproviders/proxydp/src/cmtpsetobjectproplist.cpp	Fri Apr 16 15:51:48 2010 +0300
+++ b/mtpfws/mtpfw/dataproviders/proxydp/src/cmtpsetobjectproplist.cpp	Mon May 03 13:19:02 2010 +0300
@@ -27,6 +27,7 @@
 #include "cmtpsetobjectproplist.h"
 #include "mtpproxydppanic.h"
 #include "rmtpframework.h"
+#include "cmtpstoragemgr.h"
 
 /**
 Two-phase construction method
@@ -174,6 +175,10 @@
                     // Invalid object handle.
                     iResponseCode = EMTPRespCodeInvalidObjectHandle;
                     }
+                else if(!iSingletons.StorageMgr().IsReadWriteStorage(meta->Uint(CMTPObjectMetaData::EStorageId)))
+                	{
+					iResponseCode = EMTPRespCodeAccessDenied;
+                	}
                 else
                     {
                     RArray<TUint> targets;
--- a/mtpfws/mtpfw/datatypes/bwins/mtpdatatypesU.DEF	Fri Apr 16 15:51:48 2010 +0300
+++ b/mtpfws/mtpfw/datatypes/bwins/mtpdatatypesU.DEF	Mon May 03 13:19:02 2010 +0300
@@ -645,9 +645,9 @@
 	?NewL@CMTPTypeServiceEventElement@@SAPAV1@GABVTMTPTypeGuid@@ABVTDesC16@@@Z @ 644 NONAME ; class CMTPTypeServiceEventElement * CMTPTypeServiceEventElement::NewL(unsigned short, class TMTPTypeGuid const &, class TDesC16 const &)
 	?SerivceDataBlockL@CMTPTypeServiceInfo@@QBEXIAAVTMTPTypeGuid@@@Z @ 645 NONAME ; void CMTPTypeServiceInfo::SerivceDataBlockL(unsigned int, class TMTPTypeGuid &) const
 	?Set@TMTPTypeGuid@@QAEX_K0@Z @ 646 NONAME ; void TMTPTypeGuid::Set(unsigned long long, unsigned long long)
-	?SetL@TMTPTypeGuid@@QAEHABVTDesC16@@@Z @ 647 NONAME ; int TMTPTypeGuid::SetL(class TDesC16 const &)
+	?SetL@TMTPTypeGuid@@QAEHABVTDesC16@@@Z @ 647 NONAME ABSENT ; int TMTPTypeGuid::SetL(class TDesC16 const &)
 	?NewL@CMTPTypeServicePropertyElement@@SAPAV1@GABVTMTPTypeGuid@@KABVTDesC16@@@Z @ 648 NONAME ; class CMTPTypeServicePropertyElement * CMTPTypeServicePropertyElement::NewL(unsigned short, class TMTPTypeGuid const &, unsigned long, class TDesC16 const &)
-	??0TMTPTypeGuid@@QAE@ABVTPtrC8@@@Z @ 649 NONAME ; TMTPTypeGuid::TMTPTypeGuid(class TPtrC8 const &)
+	??0TMTPTypeGuid@@QAE@ABVTPtrC8@@@Z @ 649 NONAME ABSENT ; TMTPTypeGuid::TMTPTypeGuid(class TPtrC8 const &)
 	?NewL@CMTPTypeServiceObjPropExtnForm@@SAPAV1@IVTMTPTypeGuid@@IABVTDesC16@@EPBVMMTPType@@@Z @ 650 NONAME ; class CMTPTypeServiceObjPropExtnForm * CMTPTypeServiceObjPropExtnForm::NewL(unsigned int, class TMTPTypeGuid, unsigned int, class TDesC16 const &, unsigned char, class MMTPType const *)
 	?NewLC@CMTPTypeServiceMethodParamExtnForm@@SAPAV1@IVTMTPTypeGuid@@IABVTDesC16@@EEEPBVMMTPType@@@Z @ 651 NONAME ; class CMTPTypeServiceMethodParamExtnForm * CMTPTypeServiceMethodParamExtnForm::NewLC(unsigned int, class TMTPTypeGuid, unsigned int, class TDesC16 const &, unsigned char, unsigned char, unsigned char, class MMTPType const *)
 	?NewLC@CMTPTypeServiceEventElement@@SAPAV1@GABVTMTPTypeGuid@@ABVTDesC16@@@Z @ 652 NONAME ; class CMTPTypeServiceEventElement * CMTPTypeServiceEventElement::NewLC(unsigned short, class TMTPTypeGuid const &, class TDesC16 const &)
@@ -672,4 +672,11 @@
 	?FirstReadChunk@CMTPTypeTrivialData@@UBEHAAVTPtrC8@@@Z @ 671 NONAME ; int CMTPTypeTrivialData::FirstReadChunk(class TPtrC8 &) const
 	?SetArrayL@CMTPTypeObjectPropListElement@@QAEXHABVTDesC16@@@Z @ 672 NONAME ; void CMTPTypeObjectPropListElement::SetArrayL(int, class TDesC16 const &)
 	?NextWriteChunk@CMTPTypeList@@UAEHAAVTPtr8@@I@Z @ 673 NONAME ; int CMTPTypeList::NextWriteChunk(class TPtr8 &, unsigned int)
+	??0TMTPTypeGuid@@QAE@ABVTDesC16@@@Z @ 674 NONAME ; TMTPTypeGuid::TMTPTypeGuid(class TDesC16 const &)
+	?SetL@TMTPTypeGuid@@QAEXABVTDesC16@@@Z @ 675 NONAME ; void TMTPTypeGuid::SetL(class TDesC16 const &)
+	?ToString@TMTPTypeGuid@@QBEHAAVTDes16@@@Z @ 676 NONAME ; int TMTPTypeGuid::ToString(class TDes16 &) const
+	?IsGuidFormat@TMTPTypeGuid@@SAHABVTDesC16@@@Z @ 677 NONAME ; int TMTPTypeGuid::IsGuidFormat(class TDesC16 const &)
+	?GetNumOfValidParams@TMTPTypeResponse@@QBEHXZ @ 678 NONAME ; int TMTPTypeResponse::GetNumOfValidParams(void) const
+	?SetUint32@TMTPTypeResponse@@UAEXHK@Z @ 679 NONAME ; void TMTPTypeResponse::SetUint32(int, unsigned long)
 
+
--- a/mtpfws/mtpfw/datatypes/bwins/mtpdatatypes_f32U.DEF	Fri Apr 16 15:51:48 2010 +0300
+++ b/mtpfws/mtpfw/datatypes/bwins/mtpdatatypes_f32U.DEF	Mon May 03 13:19:02 2010 +0300
@@ -645,9 +645,9 @@
 	?NewL@CMTPTypeServiceEventElement@@SAPAV1@GABVTMTPTypeGuid@@ABVTDesC16@@@Z @ 644 NONAME ; class CMTPTypeServiceEventElement * CMTPTypeServiceEventElement::NewL(unsigned short, class TMTPTypeGuid const &, class TDesC16 const &)
 	?SerivceDataBlockL@CMTPTypeServiceInfo@@QBEXIAAVTMTPTypeGuid@@@Z @ 645 NONAME ; void CMTPTypeServiceInfo::SerivceDataBlockL(unsigned int, class TMTPTypeGuid &) const
 	?Set@TMTPTypeGuid@@QAEX_K0@Z @ 646 NONAME ; void TMTPTypeGuid::Set(unsigned long long, unsigned long long)
-	?SetL@TMTPTypeGuid@@QAEHABVTDesC16@@@Z @ 647 NONAME ; int TMTPTypeGuid::SetL(class TDesC16 const &)
+	?SetL@TMTPTypeGuid@@QAEHABVTDesC16@@@Z @ 647 NONAME ABSENT ; int TMTPTypeGuid::SetL(class TDesC16 const &)
 	?NewL@CMTPTypeServicePropertyElement@@SAPAV1@GABVTMTPTypeGuid@@KABVTDesC16@@@Z @ 648 NONAME ; class CMTPTypeServicePropertyElement * CMTPTypeServicePropertyElement::NewL(unsigned short, class TMTPTypeGuid const &, unsigned long, class TDesC16 const &)
-	??0TMTPTypeGuid@@QAE@ABVTPtrC8@@@Z @ 649 NONAME ; TMTPTypeGuid::TMTPTypeGuid(class TPtrC8 const &)
+	??0TMTPTypeGuid@@QAE@ABVTPtrC8@@@Z @ 649 NONAME ABSENT ; TMTPTypeGuid::TMTPTypeGuid(class TPtrC8 const &)
 	?NewL@CMTPTypeServiceObjPropExtnForm@@SAPAV1@IVTMTPTypeGuid@@IABVTDesC16@@EPBVMMTPType@@@Z @ 650 NONAME ; class CMTPTypeServiceObjPropExtnForm * CMTPTypeServiceObjPropExtnForm::NewL(unsigned int, class TMTPTypeGuid, unsigned int, class TDesC16 const &, unsigned char, class MMTPType const *)
 	?NewLC@CMTPTypeServiceMethodParamExtnForm@@SAPAV1@IVTMTPTypeGuid@@IABVTDesC16@@EEEPBVMMTPType@@@Z @ 651 NONAME ; class CMTPTypeServiceMethodParamExtnForm * CMTPTypeServiceMethodParamExtnForm::NewLC(unsigned int, class TMTPTypeGuid, unsigned int, class TDesC16 const &, unsigned char, unsigned char, unsigned char, class MMTPType const *)
 	?NewLC@CMTPTypeServiceEventElement@@SAPAV1@GABVTMTPTypeGuid@@ABVTDesC16@@@Z @ 652 NONAME ; class CMTPTypeServiceEventElement * CMTPTypeServiceEventElement::NewLC(unsigned short, class TMTPTypeGuid const &, class TDesC16 const &)
@@ -672,3 +672,11 @@
 	?FirstReadChunk@CMTPTypeTrivialData@@UBEHAAVTPtrC8@@@Z @ 671 NONAME ; int CMTPTypeTrivialData::FirstReadChunk(class TPtrC8 &) const
 	?SetArrayL@CMTPTypeObjectPropListElement@@QAEXHABVTDesC16@@@Z @ 672 NONAME ; void CMTPTypeObjectPropListElement::SetArrayL(int, class TDesC16 const &)
 	?NextWriteChunk@CMTPTypeList@@UAEHAAVTPtr8@@I@Z @ 673 NONAME ; int CMTPTypeList::NextWriteChunk(class TPtr8 &, unsigned int)
+	??0TMTPTypeGuid@@QAE@ABVTDesC16@@@Z @ 674 NONAME ; TMTPTypeGuid::TMTPTypeGuid(class TDesC16 const &)
+	?SetL@TMTPTypeGuid@@QAEXABVTDesC16@@@Z @ 675 NONAME ; void TMTPTypeGuid::SetL(class TDesC16 const &)
+	?ToString@TMTPTypeGuid@@QBEHAAVTDes16@@@Z @ 676 NONAME ; int TMTPTypeGuid::ToString(class TDes16 &) const
+	?IsGuidFormat@TMTPTypeGuid@@SAHABVTDesC16@@@Z @ 677 NONAME ; int TMTPTypeGuid::IsGuidFormat(class TDesC16 const &)
+	?GetNumOfValidParams@TMTPTypeResponse@@QBEHXZ @ 678 NONAME ; int TMTPTypeResponse::GetNumOfValidParams(void) const
+	?SetUint32@TMTPTypeResponse@@UAEXHK@Z @ 679 NONAME ; void TMTPTypeResponse::SetUint32(int, unsigned long)
+
+
--- a/mtpfws/mtpfw/datatypes/eabi/mtpdatatypesU.DEF	Fri Apr 16 15:51:48 2010 +0300
+++ b/mtpfws/mtpfw/datatypes/eabi/mtpdatatypesU.DEF	Mon May 03 13:19:02 2010 +0300
@@ -973,10 +973,10 @@
 	_ZN12CMTPTypeFile5NewLCER3RFsRK7TDesC169TFileModexx @ 972 NONAME
 	_ZN12TMTPTypeGuid3SetEyy @ 973 NONAME
 	_ZN12TMTPTypeGuid4SetLERK7TDesC16 @ 974 NONAME
-	_ZN12TMTPTypeGuidC1ERK6TPtrC8 @ 975 NONAME
+	_ZN12TMTPTypeGuidC1ERK6TPtrC8 @ 975 NONAME ABSENT
 	_ZN12TMTPTypeGuidC1Ev @ 976 NONAME
 	_ZN12TMTPTypeGuidC1Eyy @ 977 NONAME
-	_ZN12TMTPTypeGuidC2ERK6TPtrC8 @ 978 NONAME
+	_ZN12TMTPTypeGuidC2ERK6TPtrC8 @ 978 NONAME ABSENT
 	_ZN12TMTPTypeGuidC2Ev @ 979 NONAME
 	_ZN12TMTPTypeGuidC2Eyy @ 980 NONAME
 	_ZN19CMTPTypeServiceInfo18AppendUsedServiceLERK12TMTPTypeGuid @ 981 NONAME
@@ -1034,4 +1034,10 @@
 	_ZThn4_N12CMTPTypeList14NextWriteChunkER5TPtr8j @ 1033 NONAME
 	_ZTIN12CMTPTypeFile11CFileWriterE @ 1034 NONAME
 	_ZTVN12CMTPTypeFile11CFileWriterE @ 1035 NONAME
+	_ZN12TMTPTypeGuidC1ERK7TDesC16 @ 1036 NONAME
+	_ZN12TMTPTypeGuidC2ERK7TDesC16 @ 1037 NONAME
+	_ZN12TMTPTypeGuid12IsGuidFormatERK7TDesC16 @ 1038 NONAME
+	_ZNK12TMTPTypeGuid8ToStringER6TDes16 @ 1039 NONAME
+	_ZN16TMTPTypeResponse9SetUint32Eim @ 1040 NONAME
+	_ZNK16TMTPTypeResponse19GetNumOfValidParamsEv @ 1041 NONAME
 
--- a/mtpfws/mtpfw/datatypes/group/mtpdatatypes.mmp	Fri Apr 16 15:51:48 2010 +0300
+++ b/mtpfws/mtpfw/datatypes/group/mtpdatatypes.mmp	Mon May 03 13:19:02 2010 +0300
@@ -37,6 +37,10 @@
 MW_LAYER_SYSTEMINCLUDE_SYMBIAN
 
 USERINCLUDE     ../inc
+//For UiklafInternalCRKeys.h,should be removed, after we switched to DFs
+USERINCLUDE		../../common/inc
+//For mtpframeworkconst.h
+USERINCLUDE		../../inc
 
 SOURCEPATH      ../src
 SOURCE          cmtptypearray.cpp
@@ -90,6 +94,6 @@
 LIBRARY         efsrv.lib
 LIBRARY         euser.lib
 LIBRARY         charconv.lib
-
+LIBRARY			centralrepository.lib
 
 SMPSAFE
--- a/mtpfws/mtpfw/datatypes/interface/mtpdatatypeconstants.h	Fri Apr 16 15:51:48 2010 +0300
+++ b/mtpfws/mtpfw/datatypes/interface/mtpdatatypeconstants.h	Mon May 03 13:19:02 2010 +0300
@@ -234,6 +234,14 @@
 */
 const TUint     KMTPMaxStringCharactersLength(KMTPMaxStringLength - KMTPNullCharLen);
 
+/**
+The stardand format GUID string length, 
+the GUID format should be :xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
+@publishedPartner
+@released  
+*/
+const TUint KGUIDFormatStringLength(36);
+
 #endif // MTPDATATYPECONSTANTS_H
 
 
--- a/mtpfws/mtpfw/datatypes/interface/tmtptypeguid.h	Fri Apr 16 15:51:48 2010 +0300
+++ b/mtpfws/mtpfw/datatypes/interface/tmtptypeguid.h	Mon May 03 13:19:02 2010 +0300
@@ -28,6 +28,7 @@
 #include <mtp/mtpdatatypeconstants.h>
 #include <mtp/tmtptypeuint128.h>
 
+
 /**
 Defines the MTP Guid data type.
 @publishedPartner
@@ -39,13 +40,12 @@
 public:
 
 	IMPORT_C TMTPTypeGuid();	
-	IMPORT_C TMTPTypeGuid(const TPtrC8& aData);
+	IMPORT_C TMTPTypeGuid(const TDesC& aData);
 	IMPORT_C TMTPTypeGuid(const TUint64 aData1,const TUint64 aData2);
     IMPORT_C void Set(const TUint64 aData1,const TUint64 aData2);
-    IMPORT_C TInt SetL(const TDesC& aData);
-    
-private:
-    TInt IsGuidFormat(const TDesC& aData);
+    IMPORT_C void SetL(const TDesC& aData);
+    IMPORT_C TInt ToString( TDes& aRetDes ) const;
+    IMPORT_C static TBool IsGuidFormat(const TDesC& aData);
     
 private:
     /*
@@ -69,21 +69,7 @@
         } TGUID;
     
 private:
-   
-    /**
-    Least significant 64-bit buffer offset.
-    */
-    //static const TInt           KMTPTypeUint128OffsetLS = 0;
-   
-    /**
-    Most significant 64-bit buffer offset.
-    */
-    //static const TInt           KMTPTypeUint128OffsetMS = 8;
-    
-    /**
-    The data buffer.
-    */
-	//TBuf8<KMTPTypeUINT128Size>  iData;
+    TInt StrToGUID(const TDesC& aData, TGUID& aGUID) const;
     };
 
 #endif // TMTPTYPEGUID_H
--- a/mtpfws/mtpfw/datatypes/interface/tmtptyperesponse.h	Fri Apr 16 15:51:48 2010 +0300
+++ b/mtpfws/mtpfw/datatypes/interface/tmtptyperesponse.h	Mon May 03 13:19:02 2010 +0300
@@ -80,9 +80,15 @@
         */
         EResponseParameter5, 
         
+        /*
+         * Number of valid parameter
+         */
+        
+        ENumValidParam,
         /**
         The number of dataset elements.
         */
+        
         ENumElements, 
         }; 
     
@@ -90,11 +96,14 @@
 
     IMPORT_C TMTPTypeResponse();
     IMPORT_C TMTPTypeResponse(const TMTPTypeResponse& aResponse);
+    IMPORT_C TInt GetNumOfValidParams() const;
     
 public: // From TMTPTypeFlatBase
 
     IMPORT_C TUint Type() const;
     
+    IMPORT_C void SetUint32(TInt aElementId, TUint32 aData);
+    
 private: // From TMTPTypeFlatBase
     
     IMPORT_C const TMTPTypeFlatBase::TElementInfo& ElementInfo(TInt aElementId) const;
@@ -104,7 +113,7 @@
     /**
     The dataset size in bytes.
     */
-    static const TInt                               KSize = 30;
+    static const TInt                               KSize = 34;
     
     /**
     The dataset element metadata table content.
@@ -120,6 +129,8 @@
     The data buffer.
     */
     TBuf8<KSize>                                    iBuffer; 
+    
+
     };
 
 #endif // TMTPTYPERESPONSE_H
--- a/mtpfws/mtpfw/datatypes/src/cmtptypefile.cpp	Fri Apr 16 15:51:48 2010 +0300
+++ b/mtpfws/mtpfw/datatypes/src/cmtptypefile.cpp	Mon May 03 13:19:02 2010 +0300
@@ -17,10 +17,16 @@
  @file
  @publishedPartner
  */
-
+#include <centralrepository.h>
 #include <mtp/cmtptypefile.h>
 #include <mtp/mtpdatatypeconstants.h>
 
+#include "mtpframeworkconst.h"
+
+//This file is exported from s60 sdk, now just copy it
+//to make sure onb can run
+#include "UiklafInternalCRKeys.h"
+
 // File type constants.
 const TInt KMTPFileChunkSizeForLargeFile(0x00080000); // 512K
 
@@ -32,14 +38,6 @@
 
 const TUint KUSBHeaderLen = 12;
 
-//MTP should reserve some disk space to prevent ood monitor popup
-//'Out of memory' note.When syncing music through ovi suite,
-//sometimes device screen get freeze with this note
-//If you need to adjust this value,please also update the definition
-//in file 'cmtpgetstorageinfo.cpp'
-const TInt KFreeSpaceThreshHoldValue(11*1024*1024);//11M
-
-
 CMTPTypeFile::CFileWriter* CMTPTypeFile::CFileWriter::NewL(RFile&  aFile, RBuf8& aWriteBuf)
     {
     CFileWriter *self = new(ELeave)CFileWriter(aFile, aWriteBuf);
@@ -197,7 +195,39 @@
     fs.Volume(volumeInfo,driveNo);
     fs.Close();
     
-    if(volumeInfo.iFree <= KFreeSpaceThreshHoldValue + aSize)
+    //Read the threshold value from Central Repository and check against it
+    CRepository* repository(NULL);
+    TInt thresholdValue(0);
+    TRAPD(err,repository = CRepository::NewL(KCRUidUiklaf));
+    if (err == KErrNone)
+        {
+        if (driveNo == EDriveC)
+            {
+            TInt warningUsagePercent(0);
+            err = repository->Get(KUikOODDiskFreeSpaceWarningNoteLevel,warningUsagePercent);
+            if (err == KErrNone)
+                {
+                thresholdValue = ((volumeInfo.iSize*(100-warningUsagePercent))/100)
+                    + KFreeSpaceExtraReserved;
+                }
+            }
+        else 
+            {
+            err = repository->Get(KUikOODDiskFreeSpaceWarningNoteLevelMassMemory,thresholdValue);
+            if (err == KErrNone)
+                {
+                thresholdValue += KFreeSpaceExtraReserved;
+                }
+            }
+        delete repository;
+        }
+    
+    if (err != KErrNone)
+        {
+        thresholdValue = KFreeSpaceThreshHoldDefaultValue + KFreeSpaceExtraReserved;
+        }
+    
+    if(volumeInfo.iFree <= thresholdValue + aSize)
         {
         User::Leave(KErrDiskFull);
         }
--- a/mtpfws/mtpfw/datatypes/src/tmtptypeguid.cpp	Fri Apr 16 15:51:48 2010 +0300
+++ b/mtpfws/mtpfw/datatypes/src/tmtptypeguid.cpp	Mon May 03 13:19:02 2010 +0300
@@ -29,11 +29,17 @@
     iData.FillZ(iData.MaxLength());
     }
 
-EXPORT_C TMTPTypeGuid::TMTPTypeGuid(const TPtrC8& aData) : 
-TMTPTypeUint128::TMTPTypeUint128(aData)
+EXPORT_C TMTPTypeGuid::TMTPTypeGuid(const TDesC& aData)
     {
+	TGUID guid;
+	if(StrToGUID(aData, guid) != KErrNone)
+		{
+		_LIT(KPainGUID,"TMTPTypeGuid");
+		User::Panic(KPainGUID, KErrArgument);
+		}
+	
+	memcpy(&iData[0], &guid, KMTPTypeUINT128Size);
     }
-
   
 EXPORT_C TMTPTypeGuid::TMTPTypeGuid(const TUint64 aData1,const TUint64 aData2) 
     {  
@@ -86,76 +92,28 @@
     memcpy(&iData[0], &guid, KMTPTypeUINT128Size);
 	}
 
-EXPORT_C TInt TMTPTypeGuid::SetL(const TDesC& aData)
+EXPORT_C void TMTPTypeGuid::SetL(const TDesC& aData)
 	{
-	TInt ret = KErrNone;
 	TGUID guid;
-	
-	ret = IsGuidFormat(aData);
-	
-	if ( ret != KErrNone )
+	if(StrToGUID(aData, guid) != KErrNone)
 		{
-		return ret;
-		}
-	
-	RBuf buf;
-	buf.CleanupClosePushL();
-	buf.Create(aData);		
-	TPtr8 guidPtr = buf.Collapse();			
-	TInt length = guidPtr.Length();
-	TInt offset = 0;
-	
-	TPtrC8 dataStr1(&guidPtr[offset], 8);
-	TLex8 t1(dataStr1);
-	offset += 9;
-	ret = t1.Val(guid.iUint32, EHex);
-	
-	TPtrC8 dataStr2(&guidPtr[offset], 4);
-	TLex8 t2(dataStr2);
-	offset += 5;
-	ret = t2.Val(guid.iUint16[0], EHex);
-	
-	TPtrC8 dataStr3(&guidPtr[offset], 4);
-	TLex8 t3(dataStr3);
-	offset += 5;
-	ret = t3.Val(guid.iUint16[1], EHex);
-	
-	TInt index = 0;
-	for (TInt i(offset); (i<23); i = i+2)
-		{
-		TPtrC8 dataStr4(&guidPtr[offset], 2);
-		TLex8 t4(dataStr4);
-		offset += 2;
-		ret = t4.Val(guid.iByte[index++], EHex);
-		}
-	offset++;
-	for (TInt i(offset); (i<length); i = i+2)
-		{
-		TPtrC8 dataStr5(&guidPtr[offset], 2);
-		TLex8 t5(dataStr5);
-		offset += 2;
-		ret = t5.Val(guid.iByte[index++], EHex);
+		User::Leave(KErrArgument);
 		}
 	
 	memcpy(&iData[0], &guid, KMTPTypeUINT128Size);
-	
-	CleanupStack::PopAndDestroy(&buf);
-	
-	return ret;
 	}
  
-TInt TMTPTypeGuid::IsGuidFormat(const TDesC& aData)
+EXPORT_C TBool TMTPTypeGuid::IsGuidFormat(const TDesC& aData)
 	{
-	TInt ret = KErrNone;
+	TBool ret = ETrue;
 	
 	//verify GUID style data xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
-	RBuf buf;
-	buf.CleanupClosePushL();
-	buf.Create(aData);		
+	TBuf<KGUIDFormatStringLength> buf(aData); 		
 	TPtr8 guidPtr = buf.Collapse();			
 	TInt length = guidPtr.Length();
-	
-	if ( length == 36 )
+    const TInt KSeparatorCount = 4;
+    TInt separatorcount = 0;
+	if ( length == KGUIDFormatStringLength )
 		{
 		for ( TInt i=0;i<length;++i)
 			{
@@ -163,23 +121,129 @@
 			if ( !c.IsHexDigit() )
 				{
 				if ( (guidPtr[i]=='-') && (i==8 || i==13 || i==18 || i==23) )
-					{}
+					{
+					++separatorcount;
+					}
 				else
 					{
-					ret = KErrArgument;
+					ret = EFalse;
+					break;
 					}
 				}
 			}
 		}
 	else
 		{
-		ret = KErrArgument;
+		ret = EFalse;
 		}
-	CleanupStack::PopAndDestroy(&buf);
-	
+
+	if((ret) && (KSeparatorCount != separatorcount))
+		{
+		ret = EFalse;
+		}
+		
 	return ret;
 	}
 
-
+TInt TMTPTypeGuid::StrToGUID(const TDesC& aData, TGUID& aGUID) const
+	{
+	TInt ret = KErrNone;
+	if ( !IsGuidFormat(aData) )
+		{
+		return KErrArgument;
+		}
+	
+	TBuf<KGUIDFormatStringLength> buf(aData); 
+	TPtr8 guidPtr = buf.Collapse();			
+	TInt length = guidPtr.Length();
+	TInt offset = 0;
+	
+	TPtrC8 dataStr(&guidPtr[offset], 8);
+	TLex8 t(dataStr);
+	offset += 9;
+	ret = t.Val(aGUID.iUint32, EHex);
+	if(KErrNone != ret)
+		{
+		return ret;
+		}
+	
+	dataStr.Set(&guidPtr[offset], 4);
+	t.Assign(dataStr);
+	offset += 5;
+	ret = t.Val(aGUID.iUint16[0], EHex);
+	if(KErrNone != ret)
+		{
+		return ret;
+		}
+	
+	dataStr.Set(&guidPtr[offset], 4);
+	t.Assign(dataStr);
+	offset += 5;
+	ret = t.Val(aGUID.iUint16[1], EHex);
+	if(KErrNone != ret)
+		{
+		return ret;
+		}
+	
+	TInt index = 0;
+	for (TInt i(offset); (i<23); i = i+2)
+		{
+		dataStr.Set(&guidPtr[offset], 2);
+		t.Assign(dataStr);
+		offset += 2;
+		ret = t.Val(aGUID.iByte[index++], EHex);
+		if(KErrNone != ret)
+			{
+			return ret;
+			}
+		}
+	
+	offset++;
+	for (TInt i(offset); (i<length); i = i+2)
+		{
+		dataStr.Set(&guidPtr[offset], 2);
+		t.Assign(dataStr);
+		offset += 2;
+		ret = t.Val(aGUID.iByte[index++], EHex);
+		if(KErrNone != ret)
+			{
+			return ret;
+			}
+		}
+	
+	return KErrNone;
+	}
 
-
+EXPORT_C TInt TMTPTypeGuid::ToString( TDes& aRetDes ) const
+	{
+	if(aRetDes.MaxLength() < KGUIDFormatStringLength)
+		return KErrOverflow;
+	
+	if(aRetDes.Length() > 0)
+		aRetDes.Zero();
+		
+	//xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
+	_LIT(KSeparatorChar, "-");
+	const TGUID* guid = reinterpret_cast< const TGUID*>(&iData[0]);
+	aRetDes.AppendNumFixedWidth(guid->iUint32, EHex, 8);
+	aRetDes.Append(KSeparatorChar);
+	for(TInt i = 0; i < KMTPGUIDUint16Num; i++)
+		{
+		aRetDes.AppendNumFixedWidth(guid->iUint16[i], EHex, 4);
+		aRetDes.Append(KSeparatorChar);
+		}
+	
+	TInt j = 0;
+	for(; j < 2; j++)
+		{
+		aRetDes.AppendNumFixedWidth(guid->iByte[j], EHex, 2);
+		}
+	aRetDes.Append(KSeparatorChar);
+	
+	for(; j < KMTPGUIDUint8Num; j++)
+		{
+		aRetDes.AppendNumFixedWidth(guid->iByte[j], EHex, 2);
+		}
+		
+	return KErrNone;
+	}
--- a/mtpfws/mtpfw/datatypes/src/tmtptyperesponse.cpp	Fri Apr 16 15:51:48 2010 +0300
+++ b/mtpfws/mtpfw/datatypes/src/tmtptyperesponse.cpp	Mon May 03 13:19:02 2010 +0300
@@ -20,7 +20,6 @@
 
 #include <mtp/mtpdatatypeconstants.h>
 #include <mtp/tmtptyperesponse.h>
-
 // Dataset element metadata.
 const TMTPTypeResponse::TElementInfo TMTPTypeResponse::iElementMetaData[ENumElements] = 
     {
@@ -32,6 +31,8 @@
         {EMTPTypeUINT32,    18, KMTPTypeUINT32Size},    // EResponseParameter3
         {EMTPTypeUINT32,    22, KMTPTypeUINT32Size},    // EResponseParameter4
         {EMTPTypeUINT32,    26, KMTPTypeUINT32Size},    // EResponseParameter5
+        {EMTPTypeINT32,    30, KMTPTypeUINT32Size},    // ENumValidParam
+                
     };
 
 /**
@@ -42,6 +43,7 @@
     iBuffer(KSize)
     {
     SetBuffer(iBuffer);
+    TMTPTypeFlatBase::Reset();
     }
 
 EXPORT_C TMTPTypeResponse::TMTPTypeResponse(const TMTPTypeResponse& aResponse):
@@ -61,3 +63,20 @@
     {
     return iElementInfo[aElementId];
     }
+
+EXPORT_C void TMTPTypeResponse::SetUint32(TInt aElementId, TUint32 aData)
+    {
+    // Recalculate iNumOfValidParams
+    if(aElementId - EResponseTransactionID > TMTPTypeFlatBase::Int32(ENumValidParam))
+        {
+        TMTPTypeFlatBase::SetInt32(ENumValidParam, aElementId - EResponseTransactionID);
+        }
+    //  Set the element value.
+    TMTPTypeFlatBase::SetUint32(aElementId, aData);
+    }
+
+
+EXPORT_C TInt TMTPTypeResponse::GetNumOfValidParams() const
+    {
+    return TMTPTypeFlatBase::Int32(ENumValidParam);
+    }
--- a/mtpfws/mtpfw/eabi/mtpframeworkU.DEF	Fri Apr 16 15:51:48 2010 +0300
+++ b/mtpfws/mtpfw/eabi/mtpframeworkU.DEF	Mon May 03 13:19:02 2010 +0300
@@ -232,4 +232,11 @@
 	_ZNK26CMTPDataProviderController21NeedEnumeratingPhase2Ev @ 231 NONAME
 	_ZN17CMTPConnectionMgr20SetBTResumeParameterERK10TBTDevAddrRKt @ 232 NONAME
 	_ZNK14CMTPStorageMgr18IsReadWriteStorageEm @ 233 NONAME
+	_ZN26CMTPDataProviderController21StorageEnumerateStateEj @ 234 NONAME
+	_ZN26CMTPDataProviderController22ExecutePendingRequestLEv @ 235 NONAME
+	_ZN26CMTPDataProviderController24RegisterPendingRequestDPEjj @ 236 NONAME
+	_ZTIN15CMTPObjectStore15CSnapshotWorkerE @ 237 NONAME
+	_ZTIN26CMTPDataProviderController22CMTPPendingReqestTimerE @ 238 NONAME
+	_ZTVN15CMTPObjectStore15CSnapshotWorkerE @ 239 NONAME
+	_ZTVN26CMTPDataProviderController22CMTPPendingReqestTimerE @ 240 NONAME
 
Binary file mtpfws/mtpfw/group/10282FCC_ARMV5.cre has changed
Binary file mtpfws/mtpfw/group/10282FCC_ARMV5.txt has changed
Binary file mtpfws/mtpfw/group/10282FCC_WINSCW.cre has changed
Binary file mtpfws/mtpfw/group/10282FCC_WINSCW.txt has changed
--- a/mtpfws/mtpfw/inc/cmtpdataprovider.h	Fri Apr 16 15:51:48 2010 +0300
+++ b/mtpfws/mtpfw/inc/cmtpdataprovider.h	Mon May 03 13:19:02 2010 +0300
@@ -86,7 +86,8 @@
 	void ExecuteEventL(const TMTPTypeEvent& aEvent, MMTPConnection& aConnection);
 	void ExecuteRequestL(const TMTPTypeRequest& aRequest, MMTPConnection& aConnection);
 	IMPORT_C void ExecuteProxyRequestL(const TMTPTypeRequest& aRequest, MMTPConnection& aConnection, MMTPTransactionProxy& aProxy);
-    
+    void ExecutePendingRequestL();
+
     void EnumerateObjectsL(TUint32 aStorageId);
     void EnumerateStoragesL();
     IMPORT_C TUint EnumerationState() const;
@@ -125,7 +126,8 @@
     RFs& Fs() const;
     MMTPDataCodeGenerator& DataCodeGenerator() const;
     void NotifyFrameworkL( TMTPNotificationToFramework aNotification, const TAny* aParams );
-	
+    void RegisterPendingRequest(TUint aTimeOut = 0);
+    
 private: // From CActive
 
 	void DoCancel();
--- a/mtpfws/mtpfw/inc/cmtpdataprovidercontroller.h	Fri Apr 16 15:51:48 2010 +0300
+++ b/mtpfws/mtpfw/inc/cmtpdataprovidercontroller.h	Mon May 03 13:19:02 2010 +0300
@@ -64,7 +64,8 @@
         EEnumeratingDataProviderObjects     = 5,
         EEnumeratingPhaseOneDone            = 6,
         EEnumeratingSubDirFiles				= 7, //Only File DP care the status.
-        EEnumeratedFulllyCompleted			= 8,
+        EEnumeratingCleanDBSnapshot         = 8,
+        EEnumeratedFulllyCompleted			= 9,
         };
         
 public:
@@ -95,6 +96,12 @@
     
     IMPORT_C void SetNeedEnumeratingPhase2(TBool aNeed);
     IMPORT_C TBool NeedEnumeratingPhase2() const;
+    
+    IMPORT_C void RegisterPendingRequestDP(TUint aDpUid, TUint aTimeOut = 0);
+    IMPORT_C void ExecutePendingRequestL();
+    IMPORT_C TUint StorageEnumerateState(TUint aStorageId);
+    
+
 private: // From CActive
 
     void DoCancel();
@@ -105,6 +112,7 @@
 
     CMTPDataProviderController();
     void ConstructL();
+    void EstablishDBSnapshotL(TUint32 aStorage);
     
     CMTPDataProviderConfig* CreateConfigLC(const TDesC& aResourceFilename);
     void EnumerateDataProviderObjectsL(TUint aId);
@@ -122,6 +130,32 @@
     static TInt ImplementationsLinearOrderUid(const CImplementationInformation& aL, const CImplementationInformation& aR);
     
 private: // Owned
+    
+    friend class CMTPObjectStore;
+    class CMTPPendingReqestTimer : public CTimer
+        {
+    public:
+
+        static CMTPPendingReqestTimer* NewL(CMTPDataProviderController* aDPController); 
+        virtual ~CMTPPendingReqestTimer();
+          
+        void Start(TUint aTimeOut);
+        
+    private: // From CTimer
+
+        void RunL();
+        
+    private:
+
+        CMTPPendingReqestTimer(CMTPDataProviderController* aDPController);
+        void ConstructL();
+        
+    private:
+        __FLOG_DECLARATION_MEMBER_MUTABLE;
+        
+        CMTPDataProviderController* iDPController;
+        };
+    
     /**
     FLOGGER debug trace member variable.
     */
@@ -219,6 +253,10 @@
      */
     TBool		iNeedEnumeratingPhase2;
     TUint32 	iNeedEnumeratingPhase2StorageId;
+    
+    TUint       iPendingRequestDpUid;
+    
+    CMTPPendingReqestTimer *iPendingRequestTimer;
 
     };
 
--- a/mtpfws/mtpfw/inc/cmtpobjectstore.h	Fri Apr 16 15:51:48 2010 +0300
+++ b/mtpfws/mtpfw/inc/cmtpobjectstore.h	Mon May 03 13:19:02 2010 +0300
@@ -162,6 +162,26 @@
 		CMTPObjectStore& iStore;
 		};
 	
+	class CSnapshotWorker: public CActive
+        {
+        public:
+            static CSnapshotWorker* NewL(CMTPObjectStore* aObjectStore, TBool aOnlyRoot); 
+            
+            void RunL();
+            TInt RunErr();
+            void ActiveSelf();
+            
+        private:
+            CSnapshotWorker(CMTPObjectStore* aObjectStore, TBool aOnlyRoot);
+            void ConstructL();
+
+        private:
+            void DoCancel();
+            
+        private:
+        CMTPObjectStore* iObjectStore;
+        TBool            iOnlyRoot;
+        };
 public:
 
 	static CMTPObjectStore* NewL();
@@ -179,7 +199,8 @@
 	void RemoveNonPersistentObjectsL(TUint aDataProviderId);
 	void MarkNonPersistentObjectsL(TUint aDataProviderId, TUint32 aStorageId);
 	void EstablishDBSnapshotL(TUint32 aStorageId);
-	void CleanDBSnapshotL();
+	void CleanDBSnapshotL(TBool aOnlyRoot = EFalse);
+	void ObjectsEnumComplete();
 	void MarkDPLoadedL(TUint aDataProviderId, TBool aFlag);
 
 public:
@@ -252,25 +273,26 @@
 	class CEnumertingCacheItem : public CBase
 		{
 	public:
-		static CEnumertingCacheItem* NewLC(TUint32 aSuidHash, TUint32 aHandle, TUint32 aFormat, TUint64 aId, TUint8 aDpID)
+		static CEnumertingCacheItem* NewLC(TUint32 aSuidHash, TUint32 aHandle, TUint32 aParent, TUint32 aFormat, TUint64 aId, TUint8 aDpID)
 			{
-			CEnumertingCacheItem* self = new (ELeave) CEnumertingCacheItem(aSuidHash, aHandle, aFormat, aId, aDpID);
+			CEnumertingCacheItem* self = new (ELeave) CEnumertingCacheItem(aSuidHash, aHandle, aParent, aFormat, aId, aDpID);
 			CleanupStack::PushL(self);
 			return self;
 			}
-		static CEnumertingCacheItem* NewL(TUint32 aSuidHash, TUint32 aHandle, TUint32 aFormat, TUint64 aId, TUint8 aDpID)
+		static CEnumertingCacheItem* NewL(TUint32 aSuidHash, TUint32 aHandle, TUint32 aParent, TUint32 aFormat, TUint64 aId, TUint8 aDpID)
 			{
-			CEnumertingCacheItem* self = CEnumertingCacheItem::NewLC(aSuidHash, aHandle, aFormat, aId, aDpID);
+			CEnumertingCacheItem* self = CEnumertingCacheItem::NewLC(aSuidHash, aHandle, aParent, aFormat, aId, aDpID);
 			CleanupStack::Pop();
 			return self;
 			}
 		static TInt Compare(const CEnumertingCacheItem& aFirst, const CEnumertingCacheItem& aSecond);
-		CEnumertingCacheItem(TUint32 aSuidHash, TUint32 aHandle, TUint32 aFormat, TUint64 aId, TUint8 aDpID);
+		CEnumertingCacheItem(TUint32 aSuidHash, TUint32 aHandle, TUint32 aParent, TUint32 aFormat, TUint64 aId, TUint8 aDpID);
 		~CEnumertingCacheItem()
 			{
 			delete iSuid;
 			}
 		TUint32 iObjHandleId;
+		TUint32 iObjParentId;
 		TUint32 iObjSuiIdHash;
 		TUint32 iFormatcode;
 		TUint64 iPOUID;
@@ -339,6 +361,8 @@
 	CMTPPkgIDStore*							iPkgIDStore;
 	CMtpDeltaDataMgr* 						iMtpDeltaDataMgr;
 	CDbCompactor*							iCompactor;
+	TInt                                    iSnapshotCleanPos;
+	CSnapshotWorker*                        iSnapshotWorker;
 	mutable TFileName                       iSuidBuf;
 	/**
 	 FLOGGER debug trace member variable.
--- a/mtpfws/mtpfw/inc/mtpframeworkconst.h	Fri Apr 16 15:51:48 2010 +0300
+++ b/mtpfws/mtpfw/inc/mtpframeworkconst.h	Mon May 03 13:19:02 2010 +0300
@@ -81,4 +81,14 @@
 */
 const TUint KMTPProxyDPID = 2; 
 
+//MTP should reserve some disk space to prevent OOD(Out of Disk) monitor 
+//popup 'Out of memory' note.When syncing music through ovi player,
+//sometimes device screen get freeze with this note
+//Be default, this value is read from Central Respository, if error while
+//reading, use this one
+const TInt KFreeSpaceThreshHoldDefaultValue(20*1024*1024);//20M bytes
+
+//Beside the OOD threshold value, we need to reserve extra disk space
+//for harvest server do the harvest, set this as 1M
+const TInt KFreeSpaceExtraReserved(1024*1024);//1M bytes
 #endif // MTPFRAMEWORKCONST_H
--- a/mtpfws/mtpfw/src/cmtpconnection.cpp	Fri Apr 16 15:51:48 2010 +0300
+++ b/mtpfws/mtpfw/src/cmtpconnection.cpp	Mon May 03 13:19:02 2010 +0300
@@ -780,7 +780,7 @@
     SetState(EStateErrorShutdown);
     PublishConnState(EDisconnectedFromHost);		
     iTransportConnection->CloseConnection();
-    __FLOG(_L8("UnrecoverableMTPError - Entry"));
+    __FLOG(_L8("UnrecoverableMTPError - Exit"));
     }
 
 /**
--- a/mtpfws/mtpfw/src/cmtpdataprovider.cpp	Fri Apr 16 15:51:48 2010 +0300
+++ b/mtpfws/mtpfw/src/cmtpdataprovider.cpp	Mon May 03 13:19:02 2010 +0300
@@ -134,6 +134,18 @@
     __FLOG_VA((_L8("ExecuteProxyRequestL - Exit, data provider %d "), iId));
     }
     
+void CMTPDataProvider::ExecutePendingRequestL()
+    {
+    __FLOG_VA((_L8("SchedulePendingRequestL - Entry")));
+    
+    if (iCurrentRequest != NULL && !IsActive())
+        {
+        Schedule();
+        }
+    
+    __FLOG_VA((_L8("SchedulePendingRequestL - Exit")));
+    }
+
 void CMTPDataProvider::EnumerateObjectsL(TUint32 aStorageId)
     {
     __FLOG_VA((_L8("EnumerateObjectsL - Entry, data provider %d "), iId));
@@ -503,6 +515,15 @@
     __FLOG(_L8("NotifyFrameworkL - Exit"));
     }
 
+void CMTPDataProvider::RegisterPendingRequest(TUint aTimeOut)
+    {
+    __FLOG(_L8("RegisterPendingRequestL - Entry"));
+    
+    iSingletons.DpController().RegisterPendingRequestDP(iImplementationUid.iUid, aTimeOut);
+    
+    __FLOG(_L8("RegisterPendingRequestL - Exit"));
+    }
+
 void CMTPDataProvider::DoCancel()
     {
     __FLOG_VA((_L8("DoCancel - Entry, data provider %d "), iId));
@@ -607,6 +628,7 @@
         case EMTPOpCodeGetObjectPropsSupported:
         case EMTPOpCodeGetObjectPropDesc:
         case EMTPOpCodeVendorExtextensionEnd:
+        case EMTPOpCodeGetServicePropList:
             iImplementation->ProcessRequestPhaseL(iCurrentTransactionPhase, *iCurrentRequest, *iCurrentConnection);
     	break;
 
@@ -642,7 +664,7 @@
 			iImplementation->ProcessRequestPhaseL(iCurrentTransactionPhase, *iCurrentRequest, *iCurrentConnection);
 			break; 		   
 	  case ECompletingPhase:
-	   	TransactionCompleteL(*iCurrentRequest, *iCurrentConnection);   
+		  iImplementation->ProcessRequestPhaseL(iCurrentTransactionPhase, *iCurrentRequest, *iCurrentConnection);
 		  break;
 	  default:
 		  break;
--- a/mtpfws/mtpfw/src/cmtpdataproviderconfig.cpp	Fri Apr 16 15:51:48 2010 +0300
+++ b/mtpfws/mtpfw/src/cmtpdataproviderconfig.cpp	Mon May 03 13:19:02 2010 +0300
@@ -198,11 +198,7 @@
 
     // BYTE enumeration_phase
     iEnumerationPhase = aReader.ReadUint8();
-    if (iEnumerationPhase == 0)
-      {
-      // The default value 0 is treated as 255
-      iEnumerationPhase = 255;
-      }
+    
     
     }
 
--- a/mtpfws/mtpfw/src/cmtpdataprovidercontroller.cpp	Fri Apr 16 15:51:48 2010 +0300
+++ b/mtpfws/mtpfw/src/cmtpdataprovidercontroller.cpp	Mon May 03 13:19:02 2010 +0300
@@ -84,6 +84,7 @@
     iSingletons.Close();
     CloseRegistrySessionAndEntryL();
     delete iOpenSessionWaiter;
+    delete iPendingRequestTimer;
     __FLOG(_L8("~CMTPDataProviderController - Exit"));
     __FLOG_CLOSE;
     }
@@ -108,6 +109,8 @@
     User::LeaveIfError(iSingletons.Fs().GetDir(KMTPDpResourceDirectory, KEntryAttNormal, ESortByName, registrations));
     CleanupStack::PushL(registrations);
 
+    CreateRegistrySessionAndEntryL();
+    
     // Load the registered data providers. 
     const TUint KCount(registrations->Count());
     TInt index = 0; 
@@ -180,7 +183,6 @@
 	for (TUint index=0; index < iDataProviders.Count(); index++)
 	  {
 	  if ((iDataProviders[index]->DataProviderId() != iDpIdDeviceDp)
-	  	  && (iDataProviders[index]->DataProviderId() != iDpIdFileDp)
 	  	  && (iDataProviders[index]->DataProviderId() != iDpIdProxyDp))
 	    {
 	    iDataProviderIds.Append(iDataProviders[index]->DataProviderId());
@@ -413,7 +415,7 @@
 void CMTPDataProviderController::EnumerationStateChangedL(const CMTPDataProvider& aDp)
     {
     __FLOG(_L8("EnumerationStateChangedL - Entry"));
-    __FLOG_VA((_L8("Entry iEnumerationState: 0x%x iNextDpId: %d"), iEnumerationState, iNextDpId));
+    __FLOG_VA((_L8("Entry iEnumerationState: 0x%x DpId: %d"), iEnumerationState, aDp.DataProviderId()));
     switch (iEnumerationState)
         {        
     case EEnumeratingFrameworkStorages:
@@ -456,121 +458,54 @@
             break;
             
         case KMTPImplementationUidProxyDp:
-            //iNextDpId = iDpIdFileDp;
-            if ( iDataProviderIds.Count()>0 )
-                {
-                iEnumerationState   = EEnumeratingDataProviderObjects;
-                iEnumerationPhase   = DataProviderL(iDataProviderIds[0]).DataProviderConfig().UintValue(MMTPDataProviderConfig::EEnumerationPhase);
-                iDpIdArrayIndex     = 0;                
-                }
-            else
-                {
-                iNextDpId = iDpIdFileDp;
-                }
+            iEnumerationState   = EEnumeratingDataProviderObjects;
+            iEnumerationPhase   = DataProviderL(iDataProviderIds[0]).DataProviderConfig().UintValue(MMTPDataProviderConfig::EEnumerationPhase);
+            iDpIdArrayIndex     = 0;                
             Schedule();
             break;
-            
-        case KMTPImplementationUidFileDp:
-			// No other data providers
-			if(NeedEnumeratingPhase2())
-				{
-				iEnumerationState = EEnumeratingSubDirFiles;
-				if(iOpenSessionWaiter->IsStarted())
-					{
-					iOpenSessionWaiter->AsyncStop();
-					}
-				//Schedule FildDP to enumerate the files in sub-dir
-				iNextDpId           = iDpIdFileDp;
-				Schedule();
-				}
-			else
-				{
-				iNextDpId = 0;
-				iEnumeratingStorages.Remove(0);
-				if (iEnumeratingStorages.Count() == 0)
-					{
-					iSingletons.ObjectMgr().RemoveNonPersistentObjectsL(aDp.DataProviderId());
-					iEnumerationState   = EEnumeratedFulllyCompleted;
-					iSingletons.ObjectMgr().ObjectStore().CleanDBSnapshotL();
-						
-					Cancel();
-					if(iOpenSessionWaiter->IsStarted())
-						{
-						iOpenSessionWaiter->AsyncStop();
-						}
-					}
-				else
-					{
-					// Queued enumerations.
-					iNextDpId           = iDpIdDeviceDp;
-					Schedule();
-					}
-				}
-        		
             }
         break;
         
     case EEnumeratingDataProviderObjects:
-        // Enumerate non-framework data providers concurrently.
-        iEnumeratingDps.Remove(iEnumeratingDps.FindInOrderL(aDp.DataProviderId()));
-        // Remove any non-persistent objects that are still marked.
-        iSingletons.ObjectMgr().RemoveNonPersistentObjectsL(aDp.DataProviderId());
-
-        if ((iEnumeratingDps.Count() == 0) && iDpIdArrayIndex >= iDataProviderIds.Count())
+    case EEnumeratingSubDirFiles:
+        if(KMTPImplementationUidFileDp == aDp.ImplementationUid().iUid && NeedEnumeratingPhase2())
             {
-            // Enumeration complete.
-            iNextDpId           = iDpIdFileDp;
-            iEnumerationState   = EEnumeratingFrameworkObjects;
-            			
-			if ( ( iEnumeratingStorages.Count() > 1 ) &&(KErrNotFound != iEnumeratingStorages.Find(KMTPStorageAll)) )
-				{
-				const TUint storageid = iEnumeratingStorages[0];
-				iEnumeratingStorages.Remove(0);
-				if(KMTPStorageAll == storageid)
-					{
-					iEnumeratingStorages.Append(KMTPStorageAll);
-					}
-				
-				if(iEnumeratingStorages[0] != KMTPStorageAll)
-					{
-					iNextDpId = iDpIdDeviceDp;
-					}
-				}
+            __FLOG(_L8("File DP first level enum complete"));
+            Cancel();
+
+            //clean the root level snapshot
+            iSingletons.ObjectMgr().ObjectStore().CleanDBSnapshotL(ETrue);
+
+            //Schedule again to scan subdir
+            iEnumerationState   = EEnumeratingSubDirFiles;
+
             }
         else
             {
-            if ((iEnumeratingDps.Count() == 0) && (iEnumerationPhase != DataProviderL(iDataProviderIds[iDpIdArrayIndex]).DataProviderConfig().UintValue(MMTPDataProviderConfig::EEnumerationPhase)))
+            iEnumeratingDps.Remove(iEnumeratingDps.FindInOrderL(aDp.DataProviderId()));
+            // Remove any non-persistent objects that are still marked.
+            iSingletons.ObjectMgr().RemoveNonPersistentObjectsL(aDp.DataProviderId());
+    
+            if ((iEnumeratingDps.Count() == 0) && iDpIdArrayIndex >= iDataProviderIds.Count())
                 {
-                // Enter next enumeration phase
-                iEnumerationPhase = DataProviderL(iDataProviderIds[iDpIdArrayIndex]).DataProviderConfig().UintValue(MMTPDataProviderConfig::EEnumerationPhase);
+                Cancel();
+                iEnumerationState   = EEnumeratingCleanDBSnapshot;
+                iSingletons.ObjectMgr().ObjectStore().CleanDBSnapshotL(EFalse);
+            
+
+                }
+            else
+                {
+                if ((iEnumeratingDps.Count() == 0) && (iEnumerationPhase != DataProviderL(iDataProviderIds[iDpIdArrayIndex]).DataProviderConfig().UintValue(MMTPDataProviderConfig::EEnumerationPhase)))
+                    {
+                    // Enter next enumeration phase
+                    iEnumerationPhase = DataProviderL(iDataProviderIds[iDpIdArrayIndex]).DataProviderConfig().UintValue(MMTPDataProviderConfig::EEnumerationPhase);
+                    } 
+                Schedule();
                 }
             }
-        Schedule();        
+       
         break;
-        
-    case EEnumeratingSubDirFiles:
-    	{
-    	if(aDp.ImplementationUid().iUid == KMTPImplementationUidFileDp)
-    		{
-			iSingletons.ObjectMgr().RemoveNonPersistentObjectsL(aDp.DataProviderId());
-			iNextDpId = 0;
-			iEnumeratingStorages.Remove(0);
-			if(iEnumeratingStorages.Count() == 0)
-				{
-				iSingletons.DpController().SetNeedEnumeratingPhase2(EFalse);
-				iEnumerationState   = EEnumeratedFulllyCompleted;
-				iSingletons.ObjectMgr().ObjectStore().CleanDBSnapshotL();
-				}
-			else //removable card plug in
-				{
-				iNextDpId           = iDpIdDeviceDp;
-				iEnumerationState   = EEnumeratingFrameworkObjects;
-				Schedule();
-				}
-    		}
-    	}
-    	break;
-    	
     case EEnumeratedFulllyCompleted:
     case EUnenumerated:
     case EEnumerationStarting:
@@ -580,7 +515,7 @@
         break;
         }
     
-    __FLOG_VA((_L8("Exit iEnumerationState: 0x%x, iNextDpId: %d, UID=0x%x"), iEnumerationState, iNextDpId, aDp.ImplementationUid().iUid));
+    __FLOG_VA((_L8("Exit iEnumerationState: 0x%x, DpId: %d, UID=0x%x"), iEnumerationState,  aDp.DataProviderId(), aDp.ImplementationUid().iUid));
     __FLOG(_L8("EnumerationStateChangedL - Exit"));
     }
 
@@ -590,6 +525,34 @@
     __FLOG(_L8("DoCancel - Exit"));
     }
     
+
+
+/*
+ *Buid Db SnapShot for storage
+ */
+void CMTPDataProviderController::EstablishDBSnapshotL(TUint32 aStorageId)
+    {
+    if(KMTPStorageAll == aStorageId)
+        {
+        iSingletons.ObjectMgr().ObjectStore().EstablishDBSnapshotL(aStorageId);
+        }
+    else 
+        {
+        const CMTPStorageMetaData& storage(iSingletons.StorageMgr().StorageL(aStorageId));
+        if(storage.Uint(CMTPStorageMetaData::EStorageSystemType) == CMTPStorageMetaData::ESystemTypeDefaultFileSystem)
+            {
+            const RArray<TUint>& logicalIds(storage.UintArray(CMTPStorageMetaData::EStorageLogicalIds));
+            const TUint KCountLogicalIds(logicalIds.Count());
+            for (TUint i(0); (i < KCountLogicalIds); i++)
+                {
+                __FLOG_VA((_L8("Establish snapshot for storage: 0x%x"), logicalIds[i]));
+                iSingletons.ObjectMgr().ObjectStore().EstablishDBSnapshotL(logicalIds[i]);
+                }   
+            }
+        }
+    }
+
+
 void CMTPDataProviderController::RunL()
     {
     __FLOG(_L8("RunL - Entry"));
@@ -644,37 +607,34 @@
                 }
             }
         else
-        	{
+            {
             // Enumerate framework data providers sequentially.
             if(iNextDpId == iDpIdDeviceDp)
                 {
-                if(KMTPStorageAll == storageId)
-                    {
-                    iSingletons.ObjectMgr().ObjectStore().EstablishDBSnapshotL(storageId);
-                    }
-                else 
-                    {
-					const CMTPStorageMetaData& storage(iSingletons.StorageMgr().StorageL(storageId));
-                	if(storage.Uint(CMTPStorageMetaData::EStorageSystemType) == CMTPStorageMetaData::ESystemTypeDefaultFileSystem)
-                		{
-						const RArray<TUint>& logicalIds(storage.UintArray(CMTPStorageMetaData::EStorageLogicalIds));
-						const TUint KCountLogicalIds(logicalIds.Count());
-						for (TUint i(0); (i < KCountLogicalIds); i++)
-							{
-							__FLOG_VA((_L8("Establish snapshot for storage: 0x%x"), logicalIds[i]));
-							iSingletons.ObjectMgr().ObjectStore().EstablishDBSnapshotL(logicalIds[i]);
-							}	
-                		}
-                    }
+                EstablishDBSnapshotL(storageId);
                 }
-            	
             EnumerateDataProviderObjectsL(iNextDpId);          
             }
-        	}
+        }
         break;
         
     case EEnumeratingDataProviderObjects:
+    case EEnumeratingSubDirFiles:
         {
+        
+        if(EEnumeratingSubDirFiles == iEnumerationState &&  NeedEnumeratingPhase2())
+            {
+            TUint32 storageId = iEnumeratingStorages[0];
+            EnumerateDataProviderObjectsL(iDpIdFileDp);
+            SetNeedEnumeratingPhase2(EFalse);
+            
+            if(iOpenSessionWaiter->IsStarted())
+                {
+                iOpenSessionWaiter->AsyncStop();
+                }            
+            ExecutePendingRequestL(); 
+            }
+        
         TUint currentDp = 0;
         
         // Enumerate non-framework data providers concurrently.
@@ -683,6 +643,7 @@
                && (iEnumerationPhase == DataProviderL(iDataProviderIds[iDpIdArrayIndex]).DataProviderConfig().UintValue(MMTPDataProviderConfig::EEnumerationPhase)))
             {
             currentDp = iDataProviderIds[iDpIdArrayIndex++];
+            __FLOG_VA((_L8("Enumerating dpid %d"), currentDp));
             iEnumeratingDps.InsertInOrderL(currentDp);
             EnumerateDataProviderObjectsL(currentDp);
             }
@@ -691,11 +652,29 @@
         }
         break;
         
-    case EEnumeratingSubDirFiles:
-    	{
-    	EnumerateDataProviderObjectsL(iNextDpId); 
-    	}
-    	break;
+    case EEnumeratingCleanDBSnapshot:
+        {
+        iEnumeratingStorages.Remove(0);        
+        iSingletons.ObjectMgr().ObjectStore().ObjectsEnumComplete();
+        if(iOpenSessionWaiter->IsStarted())
+            {
+            iOpenSessionWaiter->AsyncStop();
+            }
+        ExecutePendingRequestL();   
+        
+        if (iEnumeratingStorages.Count() > 0)
+            {
+            iNextDpId           = iDpIdDeviceDp;
+            iEnumerationState   = EEnumeratingFrameworkObjects;
+            Schedule();
+            }
+        else
+            {
+            iEnumerationState   = EEnumeratedFulllyCompleted; //Really finished
+            }
+        }
+        break;
+        
     case EEnumeratedFulllyCompleted:
     case EUnenumerated:
     case EEnumeratingPhaseOneDone:
@@ -777,11 +756,14 @@
 		tMTPMode = KMTPModeMTP;
 		}
 	iMode = (TMTPOperationalMode)tMTPMode;
-	CreateRegistrySessionAndEntryL();
+	//CreateRegistrySessionAndEntryL();
     
 	SetNeedEnumeratingPhase2(EFalse);
 	
     iOpenSessionWaiter = new(ELeave) CActiveSchedulerWait();
+    
+    iPendingRequestTimer = CMTPPendingReqestTimer::NewL(this);
+    
     __FLOG(_L8("ConstructL - Exit"));
     }
     
@@ -1196,6 +1178,11 @@
 
 void CMTPDataProviderController::CreateRegistrySessionAndEntryL()
 	{
+    if(iStubFound)
+        {
+        return;
+        }
+            
 	User::LeaveIfError(iSisSession.Connect());
     CleanupClosePushL(iSisSession);
     TInt err = KErrNone;
@@ -1233,3 +1220,136 @@
 	return iNeedEnumeratingPhase2;
 	}
 
+
+EXPORT_C void CMTPDataProviderController::RegisterPendingRequestDP(TUint aDpUid, TUint aTimeOut)
+    {
+    __FLOG(_L8("CMTPDataProviderController::RegisterPendingRequestDP - Entry"));
+    
+    __ASSERT_DEBUG((iPendingRequestDpUid == 0), User::Invariant());
+    iPendingRequestDpUid = aDpUid;
+    if (aTimeOut > 0)
+        {
+        iPendingRequestTimer->Start(aTimeOut);
+        }
+    
+    __FLOG(_L8("CMTPDataProviderController::RegisterPendingRequestDP - Exit"));    
+    }
+
+
+EXPORT_C void CMTPDataProviderController::ExecutePendingRequestL()
+    {
+    __FLOG(_L8("CMTPDataProviderController::ExecutePendingRequestL - Entry"));
+    
+    if (iPendingRequestDpUid == 0)
+        {
+        iPendingRequestTimer->Cancel();
+        return;
+        }
+    
+    int i = 0;
+    int count = iDataProviders.Count();
+    for (i = 0; i < count; ++i)
+        {
+        if (iDataProviders[i]->ImplementationUid().iUid == iPendingRequestDpUid)
+            {
+            iDataProviders[i]->ExecutePendingRequestL();
+            iPendingRequestDpUid = 0;
+            break;
+            }
+        }
+    
+    iPendingRequestTimer->Cancel();
+    __FLOG(_L8("CMTPDataProviderController::ExecutePendingRequestL - Exit"));    
+    }
+
+EXPORT_C TUint CMTPDataProviderController::StorageEnumerateState(TUint aStorageId)
+    {
+    if (iEnumeratingStorages.Count() == 0)
+        return EEnumeratedFulllyCompleted;
+    
+    TUint ret = EUnenumerated;
+    CMTPStorageMgr& storages = iSingletons.StorageMgr();
+    TInt idx = iEnumeratingStorages.Find(storages.PhysicalStorageId(aStorageId));
+    
+    if (idx == KErrNotFound)
+        {
+        if (iEnumeratingStorages[0] == KMTPStorageAll)
+            {
+            ret = EnumerateState();
+            }
+        else
+            {
+            ret = EEnumeratedFulllyCompleted;
+            }
+        }
+    else if (idx > 0)
+        {
+        ret = EUnenumerated;
+        }
+    else   //idx == 0
+        {
+        ret = EnumerateState();
+        }
+
+    return ret;
+    }
+
+CMTPDataProviderController::CMTPPendingReqestTimer* CMTPDataProviderController::CMTPPendingReqestTimer::NewL(CMTPDataProviderController* aDPController)
+    {
+    CMTPPendingReqestTimer* self = new (ELeave) CMTPDataProviderController::CMTPPendingReqestTimer(aDPController);
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+CMTPDataProviderController::CMTPPendingReqestTimer::~CMTPPendingReqestTimer()
+    {
+    __FLOG(_L8("~CMTPPendingReqestTimer - Entry"));  
+    
+    Cancel();
+    
+    __FLOG(_L8("~CMTPPendingReqestTimer - Exit"));    
+    __FLOG_CLOSE;
+    
+    }
+          
+void CMTPDataProviderController::CMTPPendingReqestTimer::Start(TUint aTimeOut)
+    {
+    __FLOG(_L8("CMTPPendingReqestTimer::Start - Entry"));
+    
+    if (aTimeOut > 0)
+        {
+        const TUint KMTPPendingRequestDelay = (1000000 * aTimeOut);
+        After(KMTPPendingRequestDelay);
+        }
+    
+    __FLOG(_L8("CMTPPendingReqestTimer::Start - Exit"));
+    }
+        
+void CMTPDataProviderController::CMTPPendingReqestTimer::RunL()
+    {
+    __FLOG(_L8("CMTPPendingReqestTimer::RunL - Entry"));
+
+    iDPController->ExecutePendingRequestL();
+    
+    __FLOG(_L8("CMTPPendingReqestTimer::RunL - Exit"));
+    }
+
+CMTPDataProviderController::CMTPPendingReqestTimer::CMTPPendingReqestTimer(CMTPDataProviderController* aDPController) :
+    CTimer(EPriorityNormal)
+    {
+    iDPController = aDPController;
+    }
+
+void CMTPDataProviderController::CMTPPendingReqestTimer::ConstructL()
+    {
+    __FLOG_OPEN(KMTPSubsystem, KComponent);
+    __FLOG(_L8("CMTPPendingReqestTimer::ConstructL - Entry"));
+
+    CTimer::ConstructL();
+    CActiveScheduler::Add(this);
+    
+    __FLOG(_L8("CMTPPendingReqestTimer::ConstructL - Exit"));    
+    }
+
--- a/mtpfws/mtpfw/src/cmtpobjectstore.cpp	Fri Apr 16 15:51:48 2010 +0300
+++ b/mtpfws/mtpfw/src/cmtpobjectstore.cpp	Mon May 03 13:19:02 2010 +0300
@@ -53,6 +53,56 @@
 const TInt KMaxLimitCommitAfterEnumeration = 256;
 const TInt KMaxLimitCompactInEnumeration = 2048;
 const TInt KMaxLimitCompactAfterEnumeration = 1024;
+const TInt KSnapshotGranularity = 128; 
+
+
+
+
+
+CMTPObjectStore::CSnapshotWorker* CMTPObjectStore::CSnapshotWorker::NewL(CMTPObjectStore* aObjectStore, TBool aOnlyRoot)
+    {
+    CSnapshotWorker* self = new (ELeave) CMTPObjectStore::CSnapshotWorker(aObjectStore, aOnlyRoot);
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    CleanupStack::Pop(self);
+    return self;
+
+    }
+
+void CMTPObjectStore::CSnapshotWorker::RunL()
+    {
+    iObjectStore->CleanDBSnapshotL(iOnlyRoot);
+    }
+
+void CMTPObjectStore::CSnapshotWorker::DoCancel()
+    {
+    //nothing to do
+    }
+
+TInt CMTPObjectStore::CSnapshotWorker::RunErr()
+    {
+    return KErrNone;
+    }
+
+void CMTPObjectStore::CSnapshotWorker::ActiveSelf()
+    {
+    TRequestStatus *status = &iStatus;
+    iStatus = KRequestPending;
+    User::RequestComplete(status, KErrNone);
+    SetActive();
+    }
+
+CMTPObjectStore::CSnapshotWorker::CSnapshotWorker(CMTPObjectStore* aObjectStore, TBool aOnlyRoot):
+        CActive(EPriorityLow), iObjectStore(aObjectStore), iOnlyRoot(aOnlyRoot)
+    {
+
+    }
+
+void CMTPObjectStore::CSnapshotWorker::ConstructL()
+    {
+    CActiveScheduler::Add(this);
+    }
+
 /**
  MTP object meta data store factory method. 
  @return A pointer to a new CMTPObjectStore instance, ownership IS transferred.
@@ -79,6 +129,7 @@
 	delete iDPIDStore;
 	delete iPkgIDStore;
 	delete iSentinal;
+	delete iSnapshotWorker;
 	TRAP_IGNORE(CommitTransactionL());
 	iDatabase.Compact();
 	iBatched.Close();
@@ -383,8 +434,6 @@
 
 void CMTPObjectStore::InsertObjectL(CMTPObjectMetaData& aObject)
 	{
-	//_LIT(KInsert, "CMTPObjectStore::InsertObjectL");
-	//volatile TTimer t(KInsert);
 	__FLOG(_L8("InsertObjectL - Entry"));
 	iCachedHandle = 0;
 	iCachedSuidHash = 0;
@@ -435,6 +484,7 @@
 				delete iEnumeratingCacheObjList[found];
 				iEnumeratingCacheObjList.Remove(found);
 				}
+			__FLOG_VA(_L8("Found in Snapshot"));
 			}
 		else
 			{//This is a totally new object. insert it after check the db to prevent user wrong operation
@@ -445,10 +495,14 @@
 				}
 			else
 				{
+				aObject.SetUint(CMTPObjectMetaData::EHandle, handle);
+				needUpdateOwner = ETrue;
 				//while enumerating, we ignore the repeatedly INSERT operations.
 				//User::Leave(KErrAlreadyExists);
 				}
+			__FLOG_VA(_L8("Not Found in Snapshot"));
 			}
+		__FLOG_VA((_L8("InsertObjectL Under enmueration, needUpdateOwner %d needToInsert %d"), needUpdateOwner, needToInsert));
 		}
 	else
 		{
@@ -460,6 +514,7 @@
 			}
 		// dp is not enumerating, do a plain insert
 		needToInsert = ETrue;
+		__FLOG_VA((_L8("InsertObjectL After enmueration, needUpdateOwner %d needToInsert %d"), needUpdateOwner, needToInsert));
 		}
 	if (needToInsert)//needToInsert and needUpdateOwner can't be true at same time
 		{
@@ -540,10 +595,12 @@
 
 void CMTPObjectStore::CommitTransactionL()
 	{
+	__FLOG(_L8("CommitTransactionL Entry"));
 	if (iDatabase.InTransaction())
 		{
 		User::LeaveIfError(iDatabase.Commit());
 		}
+	__FLOG(_L8("CommitTransactionL Exit"));
 	}
 
 void CMTPObjectStore::InsertObjectsL(RPointerArray<CMTPObjectMetaData>& aObjects)
@@ -699,20 +756,25 @@
 	}
 
 void CMTPObjectStore::RemoveObjectL(const TMTPTypeUint32& aHandle)
-	{
-	if (LocateByHandleL(aHandle.Value()))
-		{
-		if (iSingletons.DpController().EnumerateState() != CMTPDataProviderController::EEnumeratedFulllyCompleted &&
-			IsMediaFormat(iBatched.ColUint16(EObjectStoreFormatCode)))
-			{
-			iMtpDeltaDataMgr->UpdateDeltaDataTableL(iBatched.ColInt64(EObjectStorePOUID), CMtpDeltaDataMgr::EDeleted);
-			}
-		iCachedSuidHash = 0;
-		iCachedHandle = 0;
-		iBatched.DeleteL();
-		IncTranOpsNumL();
-		}
-	}
+    {
+    __FLOG_VA((_L8("RemoveObjectL Entry Handle = 0x%x"), aHandle.Value()));
+    if (LocateByHandleL(aHandle.Value()))
+        {
+        if (iSingletons.DpController().EnumerateState() != CMTPDataProviderController::EEnumeratedFulllyCompleted &&
+                IsMediaFormat(iBatched.ColUint16(EObjectStoreFormatCode)))
+            {
+            
+            iMtpDeltaDataMgr->UpdateDeltaDataTableL(iBatched.ColInt64(EObjectStorePOUID), CMtpDeltaDataMgr::EDeleted);
+            }
+        iCachedSuidHash = 0;
+        iCachedHandle = 0;
+        
+        iBatched.DeleteL();
+        __FLOG(_L8("RemoveObjectL From iBacthed"));
+        IncTranOpsNumL();
+        }
+    __FLOG(_L8("RemoveObjectL Exit"));
+    }
 
 void CMTPObjectStore::RemoveObjectL(const TDesC& aSuid)
 	{
@@ -833,12 +895,12 @@
 	iReferenceMgr = CMTPReferenceMgr::NewL(*this);
 	iDPIDStore = CMTPDPIDStore::NewL(iDatabase);
 	iPkgIDStore = CMTPPkgIDStore::NewL(iDatabase);
-	iBatched.Open(iDatabase, KSQLHandleTableName, RDbRowSet::EUpdatable);
-	iBatched.SetIndex(KSQLHandleId);
-	iBatched_SuidHashID.Open(iDatabase, KSQLHandleTableName, RDbRowSet::EUpdatable);
-	iBatched_SuidHashID.SetIndex(KSQLSuidHash);
+	User::LeaveIfError(iBatched.Open(iDatabase, KSQLHandleTableName, RDbRowSet::EUpdatable));
+	User::LeaveIfError(iBatched.SetIndex(KSQLHandleId));
+	User::LeaveIfError(iBatched_SuidHashID.Open(iDatabase, KSQLHandleTableName, RDbRowSet::EUpdatable));
+	User::LeaveIfError(iBatched_SuidHashID.SetIndex(KSQLSuidHash));
 	iHandleAllocator = CMTPHandleAllocator::NewL(*this);
-	iSentinal = CEnumertingCacheItem::NewL(0, 0, 0, 0, 0);
+	iSentinal = CEnumertingCacheItem::NewL(0, 0, 0, 0, 0, 0);
 	BeginTransactionL();
 	}
 
@@ -886,10 +948,7 @@
 	// Create table and index
 	CreateHandleTableL();
 	CreateHandleIndexL();
-	//This is the very very 1st time of MTP server running, therefore, all of the objects in the HandleStore should be added items
-	//roundtrip table will fetch the added items directly from the handlestore, do not popluate the added items to round-trip table
-	//until the enumeration is finished.
-	iUpdateDeltaDataTable = EFalse;
+	iUpdateDeltaDataTable = ETrue;
 	}
 
 /**
@@ -981,14 +1040,17 @@
 
 TBool CMTPObjectStore::LocateByHandleL(const TUint aHandle, const TBool aReadTable /*default = ETrue*/) const
 	{
+	__FLOG_VA((_L8("LocateByHandleL - Entry aHandle 0x%x"), aHandle));
 	TBool result = EFalse;
 	if(IsInvalidHandle(aHandle))
 		{
+		__FLOG_VA((_L8("LocateByHandleL - Exit result 0x%x"), result));
 		return result;
 		}
 	
 	if (iCachedHandle == aHandle)
 		{
+		__FLOG(_L8("CacheHit"));
 		result = ETrue;
 		}
 	else
@@ -1007,6 +1069,7 @@
 		{
 		iBatched.GetL();
 		}
+	__FLOG_VA((_L8("LocateByHandleL - Exit result 0x%x"), result));
 	return result;
 	}
 
@@ -1171,107 +1234,152 @@
 		}
 	}
 
+
+
 void CMTPObjectStore::EstablishDBSnapshotL(TUint32 aStorageId)
-	{
-	//Currently, i only do this for File DP since it is non-persistent, later, if we take the proposal that 
-	//1. FileDP is the last DP to be enumerated.
-	//2. FileDP will san the whole file system, and will try to enumerate all of the objects(might on behalf of another DP) if the objects is still not
-	// in the object store after all other DP finish its enumeration.
-	//3. Then notify the related DP about the newly added objects by notification API;
-	//_LIT(KInsert, "CMTPObjectStore::EstablishDBSnapshotL");
-	//volatile TTimer t(KInsert);
-	RDbTable temp;
-	CleanupClosePushL(temp);
-	temp.Open(iDatabase, KSQLHandleTableName, RDbRowSet::EUpdatable);
+    {
+    //Currently, i only do this for File DP since it is non-persistent, later, if we take the proposal that 
+    //1. FileDP is the last DP to be enumerated.
+    //2. FileDP will san the whole file system, and will try to enumerate all of the objects(might on behalf of another DP) if the objects is still not
+    // in the object store after all other DP finish its enumeration.
+    //3. Then notify the related DP about the newly added objects by notification API;
+    __FLOG(_L8("EstablishDBSnapshotL - Entry"));
+    RDbTable temp;
+    CleanupClosePushL(temp);
+    User::LeaveIfError(temp.Open(iDatabase, KSQLHandleTableName, RDbRowSet::EUpdatable));
     if(!iCacheExist)
         {
-	TInt32 count = temp.CountL(RDbRowSet::EQuick);
+        TInt32 count = temp.CountL(RDbRowSet::EQuick);
         iEnumeratingCacheObjList.ReserveL(count);
         }
-	temp.FirstL();
-	while (!temp.AtEnd())
-		{
-		temp.GetL();
-        if (temp.ColUint8(EObjectStoreDPFlag) == 1 && (KMTPStorageAll == aStorageId || temp.ColUint32(EObjectStoreStorageId) == aStorageId))
-			{
-			TUint32 handleID = temp.ColUint32(EObjectStoreHandleId);
-			TInt64 pUID = temp.ColInt64(EObjectStorePOUID);
-			iHandleAllocator->SetIdL(handleID, pUID);
-			CEnumertingCacheItem* item = CEnumertingCacheItem::NewLC(
-					temp.ColUint32(EObjectStoreSUIDHash), handleID,
-					temp.ColUint16(EObjectStoreFormatCode), pUID, temp.ColUint8(EObjectStoreDataProviderId));
-			TInt result = iEnumeratingCacheObjList.InsertInOrder(item, TLinearOrder<CEnumertingCacheItem>(CEnumertingCacheItem::Compare));
-			if (KErrAlreadyExists == result) //hash collision
-				{
-				TInt found = iEnumeratingCacheObjList.FindInOrder(item, TLinearOrder<CEnumertingCacheItem>(CEnumertingCacheItem::Compare));
-				CEnumertingCacheItem* colliItem = iEnumeratingCacheObjList[found];
+    temp.FirstL();
+
+    while (!temp.AtEnd())
+        {
+        temp.GetL();
+        if (temp.ColUint8(EObjectStoreDPFlag) == 1 
+                && (KMTPStorageAll == aStorageId || temp.ColUint32(EObjectStoreStorageId) == aStorageId))
+            {
+            TUint32 handleID = temp.ColUint32(EObjectStoreHandleId);
+            TUint32 parentID = temp.ColUint32(EObjectStoreParentHandle);
+            TInt64 pUID = temp.ColInt64(EObjectStorePOUID);
+            iHandleAllocator->SetIdL(handleID, pUID);
+            CEnumertingCacheItem* item = CEnumertingCacheItem::NewLC(
+                    temp.ColUint32(EObjectStoreSUIDHash), handleID, parentID,
+                    temp.ColUint16(EObjectStoreFormatCode), pUID, temp.ColUint8(EObjectStoreDataProviderId));
+            TInt result = iEnumeratingCacheObjList.InsertInOrder(item, TLinearOrder<CEnumertingCacheItem>(CEnumertingCacheItem::Compare));
+            if (KErrAlreadyExists == result) //hash collision
+                {
+                TInt found = iEnumeratingCacheObjList.FindInOrder(item, TLinearOrder<CEnumertingCacheItem>(CEnumertingCacheItem::Compare));
+                CEnumertingCacheItem* colliItem = iEnumeratingCacheObjList[found];
                 TFileName suid;
-				if (colliItem->iSuid == NULL)
-					{
-					if (LocateByHandleL(colliItem->iObjHandleId))
-					    {
-					    DbColReadStreamL(iBatched, EObjectStoreSUID, suid);
-					    
-					    colliItem->iSuid = suid.AllocL();
-					    
-					    colliItem->iSuidPtr.Set(*colliItem->iSuid);
-					    }
-					}
+                if (colliItem->iSuid == NULL)
+                    {
+                    if (LocateByHandleL(colliItem->iObjHandleId))
+                        {
+                        DbColReadStreamL(iBatched, EObjectStoreSUID, suid);
+                        colliItem->iSuid = suid.AllocL();
+                        colliItem->iSuidPtr.Set(*colliItem->iSuid);
+                        }
+                    }
+
                 DbColReadStreamL(temp, EObjectStoreSUID, suid);
-				
+                
                 item->iSuid = suid.AllocL();
                 
-				item->iSuidPtr.Set(*item->iSuid);
+                item->iSuidPtr.Set(*item->iSuid);
                 result = iEnumeratingCacheObjList.InsertInOrder(item, TLinearOrder<CEnumertingCacheItem>(CEnumertingCacheItem::Compare));
-				}
+                }
+            
             if(result != KErrAlreadyExists)
-				{
-				User::LeaveIfError(result);
-				}
-			CleanupStack::Pop(item);
-			}
-		temp.NextL();
-		}
-	CleanupStack::PopAndDestroy(&temp);
-	iCacheExist = ETrue;
-	}
+                {
+                User::LeaveIfError(result);
+                CleanupStack::Pop(item);
+                }
+            else
+                {
+                CleanupStack::PopAndDestroy(item);
+                }
+
+            }
+        temp.NextL();
+        }
 
-void CMTPObjectStore::CleanDBSnapshotL()
-	{
-	//For those items left in the iEnumeratingCacheObjList, remove the object entry if the DPID of the handle is not persistent. and populate the 
-	//roundtrip table if needed.
-	//and then close the iEnumeratingCacheObjList to release the memory.
-	//_LIT(KInsert, "CMTPObjectStore::CleanDBSnapshot");
-	//volatile TTimer t(KInsert);
-	if(iCacheExist)
-	    {
-	        iCacheExist = EFalse;
-	    }
-	else 
-	    return;
-
-	for (TInt i = iEnumeratingCacheObjList.Count() - 1; i >= 0; i--)
-		{
-		TInt rc = iNonPersistentDPList.FindInOrder(iEnumeratingCacheObjList[i]->iDpID);
-		if (rc != KErrNotFound)
-			{//This is a non persistent DP.
-			RemoveObjectL(iEnumeratingCacheObjList[i]->iObjHandleId);
-			}
-		}
-	iNonPersistentDPList.Close();
-	iEnumeratingCacheObjList.ResetAndDestroy();
-	iUpdateDeltaDataTable = ETrue;
-	iMaxCommitLimit = KMaxLimitCommitAfterEnumeration;
-	iMaxCompactLimit = KMaxLimitCompactAfterEnumeration;
+    CleanupStack::PopAndDestroy(&temp);
+    iCacheExist = ETrue;
+    __FLOG_VA((_L8("EstablishDBSnapshotL - Exit build %d items"), iEnumeratingCacheObjList.Count()));
+    }
+/*
+ * All Objects enumeration complete
+ */
+void CMTPObjectStore::ObjectsEnumComplete()
+    {
+    if(iCacheExist)
+        {
+        iCacheExist = EFalse;
+        }
+    iNonPersistentDPList.Close();
+    iEnumeratingCacheObjList.ResetAndDestroy();
+    iUpdateDeltaDataTable = ETrue;
+    iMaxCommitLimit = KMaxLimitCommitAfterEnumeration;
+    iMaxCompactLimit = KMaxLimitCompactAfterEnumeration;
     CommitTransactionL();
     User::LeaveIfError(iDatabase.Compact());
     BeginTransactionL();
-	}
+    }
+
 
-CMTPObjectStore::CEnumertingCacheItem::CEnumertingCacheItem(TUint32 aSuidHash, TUint32 aHandle, TUint32 aFormat, TUint64 aId, TUint8 aDpID)
+void CMTPObjectStore::CleanDBSnapshotL(TBool aOnlyRoot/* = EFalse*/)
+    {
+    //For those items left in the iEnumeratingCacheObjList, remove the object entry if the DPID of the handle is not persistent. and populate the 
+    //roundtrip table if needed.
+    //and then close the iEnumeratingCacheObjList to release the memory.
+    //_LIT(KInsert, "CMTPObjectStore::CleanDBSnapshot");
+    //volatile TTimer t(KInsert);
+    __FLOG(_L8("CleanDBSnapshotL Entry"));
+    if (iSnapshotWorker == NULL)
+        {
+        iSnapshotCleanPos = iEnumeratingCacheObjList.Count() - 1;
+        iSnapshotWorker = CSnapshotWorker::NewL(this, aOnlyRoot);
+        }
+    
+    //for (TInt i = iEnumeratingCacheObjList.Count() - 1; i >= 0; i--)
+    for (TInt i = 0; iSnapshotCleanPos >= 0 && i <= KSnapshotGranularity; --iSnapshotCleanPos, ++i)
+        {
+        if((aOnlyRoot && iEnumeratingCacheObjList[iSnapshotCleanPos]->iObjParentId == KMTPHandleNoParent) //only root 
+           ||(!aOnlyRoot)) //everything
+            {
+            TInt rc = iNonPersistentDPList.FindInOrder(iEnumeratingCacheObjList[iSnapshotCleanPos]->iDpID);
+            if (rc != KErrNotFound)
+                {//This is a non persistent DP.
+                __FLOG_VA((_L8("Remove Object 0x%x"), iEnumeratingCacheObjList[iSnapshotCleanPos]->iObjHandleId));
+                RemoveObjectL(iEnumeratingCacheObjList[iSnapshotCleanPos]->iObjHandleId);
+                }
+            }
+        }
+    
+    if (iSnapshotCleanPos >= 0)
+        {
+        iSnapshotWorker->ActiveSelf();
+        }
+    else
+        {
+        //TRequestStatus *status = &aStatus;
+        //User::RequestComplete(status, KErrNone);
+        iSingletons.DpController().Schedule();
+        iSnapshotCleanPos = 0;
+        delete iSnapshotWorker;
+        iSnapshotWorker = NULL;
+        }
+    
+    __FLOG(_L8("CleanDBSnapshotL Exit"));
+    }
+
+CMTPObjectStore::CEnumertingCacheItem::CEnumertingCacheItem(TUint32 aSuidHash, TUint32 aHandle, TUint32 aParent, TUint32 aFormat, TUint64 aId, TUint8 aDpID)
 	{
 	iObjSuiIdHash = aSuidHash;
 	iObjHandleId = aHandle;
+	iObjParentId = aParent;
 	iFormatcode = aFormat;
 	iPOUID = aId;
 	iDpID = aDpID;
--- a/mtpfws/mtpfw/src/cmtpparserrouter.cpp	Fri Apr 16 15:51:48 2010 +0300
+++ b/mtpfws/mtpfw/src/cmtpparserrouter.cpp	Mon May 03 13:19:02 2010 +0300
@@ -2311,6 +2311,8 @@
 	__FLOG_VA((_L8("Operation Code = 0x%04X"), KOpCode));
 	switch (KOpCode)
 	   {
+		case EMTPOpCodeSetObjectPropValue:
+		case EMTPOpCodeSetObjectProtection:
 		case EMTPOpCodeDeleteObject:
 			{
 			const TUint32 KObjectHandle(aParams.Request().Uint32(TMTPTypeRequest::ERequestParameter1));
--- a/mtptransports/mtpusbtransport/usbdatatypes/src/tmtpusbparameterpayloadblock.cpp	Fri Apr 16 15:51:48 2010 +0300
+++ b/mtptransports/mtpusbtransport/usbdatatypes/src/tmtpusbparameterpayloadblock.cpp	Mon May 03 13:19:02 2010 +0300
@@ -65,26 +65,17 @@
 @param aIsNullParamValid a boolean value to check if a null parameter is valid. A value of ETrue means a null parameter is valid; EFalse means invalid.
 @param aNumOfNullParam the number of valid null parameters to be copied.
 */
-EXPORT_C void TMTPUsbParameterPayloadBlock::CopyIn(const TMTPTypeFlatBase& aFrom, TUint aParamStartOffset, TUint aParamEndOffset, TBool aIsNullParamValid, TUint aNumOfNullParam)
+EXPORT_C void TMTPUsbParameterPayloadBlock::CopyIn(const TMTPTypeFlatBase& aFrom, TUint aParamStartOffset, TUint aParamEndOffset, TBool /*aIsNullParamValid*/, TUint /*aNumOfNullParam*/)
     {
-    __ASSERT_DEBUG((aParamEndOffset >= aParamStartOffset && (aParamEndOffset - aParamStartOffset + 1) <= ENumElements), User::Invariant());
+    __ASSERT_DEBUG((aParamEndOffset >= aParamStartOffset && (aParamEndOffset - aParamStartOffset) <= ENumElements), User::Invariant());
     TUint32 parameter = KMTPNotSpecified32;
-    TUint numberOfNullParam = 0;
     TUint loopCount =  aParamEndOffset - aParamStartOffset;  
-	
-	for (TUint i(TMTPUsbParameterPayloadBlock::EParameter1); i <= loopCount; i++)
-	    {
-	    parameter = aFrom.Uint32(aParamStartOffset + i);
-	    if (parameter != KMTPNotSpecified32)
-	        {
-	        SetUint32(i, parameter);
-	        }
-	    else if(aIsNullParamValid && (numberOfNullParam < aNumOfNullParam))
-	        {
-	        SetUint32(i, parameter);
-	        numberOfNullParam++;
-	        }
-	    }     		
+
+    for (TUint i(TMTPUsbParameterPayloadBlock::EParameter1); i < loopCount; i++)
+        {
+        parameter = aFrom.Uint32(aParamStartOffset + i);
+        SetUint32(i, parameter);
+        }
     }
 
 /**
--- a/mtptransports/mtpusbtransport/usbsic_imp/src/cmtpusbconnection.cpp	Fri Apr 16 15:51:48 2010 +0300
+++ b/mtptransports/mtpusbtransport/usbsic_imp/src/cmtpusbconnection.cpp	Mon May 03 13:19:02 2010 +0300
@@ -298,16 +298,8 @@
    		*/
    		iUsbBulkParameterBlock.Reset();
         TBool isNullParamValid = EFalse;
-        TUint numberOfNullParam = 0;    
-        /*
-        A special case: for GetNumObjects the first response parameter can be null, which means 0 objects.
-        */
-        if(opCode == EMTPOpCodeGetNumObjects)
-            {
-            isNullParamValid = ETrue;
-            numberOfNullParam = 1;
-            }
-        iUsbBulkParameterBlock.CopyIn(aResponse, TMTPTypeResponse::EResponseParameter1, TMTPTypeResponse::EResponseParameter5, isNullParamValid, numberOfNullParam);
+        TUint numberOfNullParam = 0;
+        iUsbBulkParameterBlock.CopyIn(aResponse, TMTPTypeResponse::EResponseParameter1, TMTPTypeResponse::EResponseParameter1 + aResponse.GetNumOfValidParams(), isNullParamValid, numberOfNullParam);
 
    		// Setup the bulk container.
    		iUsbBulkContainer->SetPayloadL(const_cast<TMTPUsbParameterPayloadBlock*>(&iUsbBulkParameterBlock));