--- a/backupandrestore/backupengine/group/sbengine.mmp Mon Mar 15 12:43:12 2010 +0200
+++ b/backupandrestore/backupengine/group/sbengine.mmp Wed Mar 31 22:58:56 2010 +0300
@@ -75,7 +75,7 @@
#endif
-CAPABILITY ProtServ AllFiles WriteDeviceData ReadUserData
+CAPABILITY ProtServ AllFiles WriteDeviceData ReadUserData TrustedUi
START WINS
// ?wins_specific_information
--- a/mtpdataproviders/mtpfileandfolderdp/src/cmtpfiledp.cpp Mon Mar 15 12:43:12 2010 +0200
+++ b/mtpdataproviders/mtpfileandfolderdp/src/cmtpfiledp.cpp Wed Mar 31 22:58:56 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 Mon Mar 15 12:43:12 2010 +0200
+++ b/mtpdataproviders/mtpfileandfolderdp/src/mtpfiledp_config.rss Wed Mar 31 22:58:56 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/cmtpimagedpsendobjectinfo.h Mon Mar 15 12:43:12 2010 +0200
+++ b/mtpdataproviders/mtpimagedp/inc/cmtpimagedpsendobjectinfo.h Wed Mar 31 22:58:56 2010 +0300
@@ -124,7 +124,7 @@
static TBool FsmDoHandleSendObjectCompleteL(CMTPImageDpSendObjectInfo* aObject, TAny *aPtr);
TBool GetFullPathName(const TDesC& aFileName);
- TBool CanStoreFileL(TUint32 aStorageId, TInt64 aObjectSize) const;
+
TBool Exists(const TDesC& aName) const;
void ReserveObjectL();
@@ -148,6 +148,8 @@
void SetPropertiesL();
TBool IsFormatValid(TMTPFormatCode aFormat) const;
+ void CreateFsObjectL();
+ TMTPResponseCode ErrorToMTPError(TInt err)const;
private: // Owned
/**
--- a/mtpdataproviders/mtpimagedp/src/cmtpimagedpsendobjectinfo.cpp Mon Mar 15 12:43:12 2010 +0200
+++ b/mtpdataproviders/mtpimagedp/src/cmtpimagedpsendobjectinfo.cpp Wed Mar 31 22:58:56 2010 +0300
@@ -322,12 +322,7 @@
{
iStorageId = iFramework.StorageMgr().DefaultStorageId();
}
-
- //if the object size is more,then report this error.
- if (!CanStoreFileL(iStorageId, iObjectSize))
- {
- *ret = EMTPRespCodeStoreFull;
- }
+
}
__FLOG(_L8("CMTPImageDpSendObjectInfo::CheckObjectPropListParamsL - Exit"));
@@ -515,15 +510,8 @@
iFramework.ObjectMgr().CommitReservedObjectHandleL(*iReceivedObject);
//prepare for rollback
- iRollbackList.Append(RemoveObjectFromDb);
+ iRollbackList.Append(RemoveObjectFromDb);
- delete iFileReceived;
- iFileReceived = NULL;
- iFileReceived = CMTPTypeFile::NewL(iFramework.Fs(), iFullPath, EFileWrite);
- iFileReceived->SetSizeL(iObjectSize);
-
- //prepare for rollback
- iRollbackList.Append(RemoveObjectFromFs);
ReceiveDataL(*iFileReceived);
__FLOG(_L8("CMTPImageDpSendObjectInfo::ServiceSendObjectL - Exit"));
@@ -620,11 +608,6 @@
if (result)
{
iObjectSize = iObjectInfo->Uint32L(CMTPTypeObjectInfo::EObjectCompressedSize);
- if(!CanStoreFileL(iStorageId, iObjectSize))
- {
- SendResponseL(EMTPRespCodeStoreFull);
- result = EFalse;
- }
}
if (result)
@@ -656,14 +639,25 @@
SendResponseL(EMTPRespCodeAccessDenied);
}
else
- {
- ReserveObjectL();
- imageWidth = iObjectInfo->Uint32L(CMTPTypeObjectInfo::EImagePixWidth);
- imageHeight = iObjectInfo->Uint32L(CMTPTypeObjectInfo::EImagePixHeight);
- imageBitDepth = iObjectInfo->Uint32L(CMTPTypeObjectInfo::EImageBitDepth);
- iReceivedObject->SetUint(CMTPObjectMetaData::EFormatCode, format);
- SetPropertiesL();
- ReturnResponseL();
+ {
+ TRAPD(err,CreateFsObjectL());
+ if (err != KErrNone)
+ {
+ __FLOG_1(_L8("Fail to create fs object %d"),err);
+ SendResponseL(ErrorToMTPError(err));
+ Rollback();
+ result = EFalse;
+ }
+ else
+ {
+ ReserveObjectL();
+ imageWidth = iObjectInfo->Uint32L(CMTPTypeObjectInfo::EImagePixWidth);
+ imageHeight = iObjectInfo->Uint32L(CMTPTypeObjectInfo::EImagePixHeight);
+ imageBitDepth = iObjectInfo->Uint32L(CMTPTypeObjectInfo::EImageBitDepth);
+ iReceivedObject->SetUint(CMTPObjectMetaData::EFormatCode, format);
+ SetPropertiesL();
+ ReturnResponseL();
+ }
}
}
@@ -719,10 +713,21 @@
if (result)
{
- //the EFormatCode property has been set in ServiceSendObjectPropListL() function
- ReserveObjectL();
- SetPropertiesL();
- ReturnResponseL();
+ TRAPD(err,CreateFsObjectL());
+ if (err != KErrNone)
+ {
+ __FLOG_1(_L8("Fail to create fs object %d"),err);
+ SendResponseL(ErrorToMTPError(err));
+ Rollback();
+ result = EFalse;
+ }
+ else
+ {
+ //the EFormatCode property has been set in ServiceSendObjectPropListL() function
+ ReserveObjectL();
+ SetPropertiesL();
+ ReturnResponseL();
+ }
}
iSuccessful = result;
@@ -789,14 +794,18 @@
}
User::LeaveIfError(iFileReceived->File().SetAtt(attValue, ~attValue));
}
-
+ TTime modifiedTime;
//update datemodified property.
if(iDateMod != NULL && iDateMod->Length())
- {
- TTime modifiedTime;
+ {
iObjectPropertyMgr.ConvertMTPTimeStr2TTimeL(*iDateMod, modifiedTime);
User::LeaveIfError(iFileReceived->File().SetModified(modifiedTime));
- }
+ }
+ else if(iDateCreated != NULL && iDateCreated->Length())
+ {
+ iObjectPropertyMgr.ConvertMTPTimeStr2TTimeL(*iDateCreated, modifiedTime);
+ User::LeaveIfError(iFileReceived->File().SetModified(modifiedTime));
+ }
iFramework.RouteRequestUnregisterL(iExpectedSendObjectRequest, iConnection);
@@ -841,7 +850,8 @@
}
void CMTPImageDpSendObjectInfo::RemoveObjectFromFs()
- {
+ {
+ __FLOG(_L8("RemoveObjectFromFs"));
delete iFileReceived;
iFileReceived = NULL;
TInt err = iFramework.Fs().Delete(iFullPath);
@@ -918,31 +928,6 @@
}
/**
-Check if we can store the file on the storage
-@return ETrue if yes, otherwise EFalse
-*/
-TBool CMTPImageDpSendObjectInfo::CanStoreFileL(TUint32 aStorageId, TInt64 aObjectSize) const
- {
- __FLOG(_L8("CMTPImageDpSendObjectInfo::CanStoreFileL - Entry"));
- TBool result(ETrue);
- if (aStorageId == KMTPStorageDefault)
- {
- aStorageId = iFramework.StorageMgr().DefaultStorageId();
- }
-
- TDriveNumber drive(static_cast<TDriveNumber>(iFramework.StorageMgr().DriveNumber(aStorageId)));
- User::LeaveIfError(drive);
- TVolumeInfo volumeInfo;
- User::LeaveIfError(iFramework.Fs().Volume(volumeInfo, drive));
- if (volumeInfo.iFree < aObjectSize)
- {
- result = EFalse;
- }
- __FLOG(_L8("CMTPImageDpSendObjectInfo::CanStoreFileL - Exit"));
- return result;
- }
-
-/**
Check if the file already exists on the storage.
@return ETrue if file is exists, otherwise EFalse
*/
@@ -1256,3 +1241,39 @@
__FLOG(_L8("CMTPImageDpSendObjectInfo::CleanUndoList - Exit"));
}
+
+void CMTPImageDpSendObjectInfo::CreateFsObjectL()
+ {
+ delete iFileReceived;
+ iFileReceived = NULL;
+ //prepare for rollback
+ iRollbackList.Append(RemoveObjectFromFs);
+
+ iFileReceived = CMTPTypeFile::NewL(iFramework.Fs(), iFullPath, EFileWrite);
+ iFileReceived->SetSizeL(iObjectSize);
+ }
+
+TMTPResponseCode CMTPImageDpSendObjectInfo::ErrorToMTPError(TInt aError) const
+ {
+ TMTPResponseCode resp = EMTPRespCodeGeneralError;
+
+ switch (aError)
+ {
+ case KErrNone:
+ resp = EMTPRespCodeOK;
+ break;
+
+ case KErrAccessDenied:
+ resp = EMTPRespCodeAccessDenied;
+ break;
+
+ case KErrDiskFull:
+ resp = EMTPRespCodeStoreFull;
+ break;
+
+ default:
+ break;
+ }
+
+ return resp;
+ }
--- a/mtpdataproviders/mtppictbridgedp/inc/cmtppictbridgedpsendobjectinfo.h Mon Mar 15 12:43:12 2010 +0200
+++ b/mtpdataproviders/mtppictbridgedp/inc/cmtppictbridgedpsendobjectinfo.h Wed Mar 31 22:58:56 2010 +0300
@@ -72,7 +72,6 @@
TBool GetFullPathNameL(const TDesC& aFileName);
- TBool CanStoreFileL(TUint32 aStorageId, TInt64 aObjectSize) const;
TBool IsTooLarge(TUint64 aObjectSize) const;
void ReserveObjectL();
void CreateFsObjectL();
--- a/mtpdataproviders/mtppictbridgedp/src/cmtppictbridgedpsendobjectinfo.cpp Mon Mar 15 12:43:12 2010 +0200
+++ b/mtpdataproviders/mtppictbridgedp/src/cmtppictbridgedpsendobjectinfo.cpp Wed Mar 31 22:58:56 2010 +0300
@@ -70,7 +70,8 @@
CMTPPictBridgeDpSendObjectInfo::~CMTPPictBridgeDpSendObjectInfo()
{
__FLOG_VA((_L8(">> CMTPPictBridgeDpSendObjectInfo::~CMTPPictBridgeDpSendObjectInfo iProgress=%d iNoRollback=%d "), iProgress, iNoRollback));
-
+ __FLOG_2(_L8("iProgress:%d NoRollback:%d"),iProgress,iNoRollback);
+
if ((iProgress == EObjectInfoSucceed ||
iProgress == EObjectInfoFail ||
iProgress == EObjectInfoInProgress) && !iNoRollback)
@@ -146,11 +147,7 @@
if (IsTooLarge(iObjectSize))
{
result = EMTPRespCodeObjectTooLarge;
- }
- if(result && !CanStoreFileL(iStorageId, iObjectSize))
- {
- result = EMTPRespCodeStoreFull;
- }
+ }
}
// If the previous request is not SendObjectInfo, SendObject fails
if (result == EMTPRespCodeOK && iOperationCode == EMTPOpCodeSendObject)
@@ -295,7 +292,7 @@
result = EFalse;
}
- __FLOG(_L8("<< CMTPPictBridgeDpSendObjectInfo::DoHandleCompletingPhaseL"));
+ __FLOG_2(_L8("<< CMTPPictBridgeDpSendObjectInfo::DoHandleCompletingPhaseL result:%d progress %d"),result,iProgress);
return result;
}
@@ -477,11 +474,6 @@
SendResponseL(EMTPRespCodeObjectTooLarge);
result = EFalse;
}
- if(result && !CanStoreFileL(iStorageId, iObjectSize))
- {
- SendResponseL(EMTPRespCodeStoreFull);
- result = EFalse;
- }
}
if (result)
@@ -528,7 +520,9 @@
if (err != KErrNone)
{
+ __FLOG_1(_L8("Fail to create fs object %d"),err);
SendResponseL(ErrorToMTPError(err));
+ result = EFalse;
}
else
{
@@ -574,7 +568,9 @@
TRAPD(err, CreateFsObjectL());
if ( err != KErrNone )
{
+ __FLOG_1(_L8("Fail to create fs object %d"),err);
SendResponseL(ErrorToMTPError(err));
+ result = EFalse;
}
else
{
@@ -695,28 +691,6 @@
}
/**
-Check if we can store the file on the storage
-@return ETrue if yes, otherwise EFalse
-*/
-TBool CMTPPictBridgeDpSendObjectInfo::CanStoreFileL(TUint32 aStorageId, TInt64 aObjectSize) const
- {
- TBool result(ETrue);
- if (aStorageId == KMTPStorageDefault)
- {
- aStorageId = iFramework.StorageMgr().DefaultStorageId();
- }
- TInt drive(iFramework.StorageMgr().DriveNumber(aStorageId));
- User::LeaveIfError(drive);
- TVolumeInfo volumeInfo;
- User::LeaveIfError(iFramework.Fs().Volume(volumeInfo, drive));
- if (volumeInfo.iFree < aObjectSize)
- {
- result = EFalse;
- }
- return result;
- }
-
-/**
Check if the object is too large
@return ETrue if yes, otherwise EFalse
*/
--- a/mtpdataproviders/mtppictbridgedp/src/cmtppictbridgeprinter.cpp Mon Mar 15 12:43:12 2010 +0200
+++ b/mtpdataproviders/mtppictbridgedp/src/cmtppictbridgeprinter.cpp Wed Mar 31 22:58:56 2010 +0300
@@ -229,7 +229,7 @@
aEvent.SetUint16(TMTPTypeEvent::EEventCode, EMTPEventCodeRequestObjectTransfer);
aEvent.SetUint32(TMTPTypeEvent::EEventSessionID, KMTPSessionAll);
- aEvent.SetUint32(TMTPTypeEvent::EEventTransactionID, KMTPNotSpecified32);
+ aEvent.SetUint32(TMTPTypeEvent::EEventTransactionID, KMTPTransactionIdLast);
aEvent.SetUint32(TMTPTypeEvent::EEventParameter1, aHandle);
aEvent.SetUint32(TMTPTypeEvent::EEventParameter2, KPtpNoValue);
--- a/mtpfws/mtpfw/bwins/mtpframeworkU.DEF Mon Mar 15 12:43:12 2010 +0200
+++ b/mtpfws/mtpfw/bwins/mtpframeworkU.DEF Wed Mar 31 22:58:56 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)
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mtpfws/mtpfw/common/inc/uiklafinternalcrkeys.h Wed Mar 31 22:58:56 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/dataproviders/dataproviderapi/interface/mmtpdataproviderframework.h Mon Mar 15 12:43:12 2010 +0200
+++ b/mtpfws/mtpfw/dataproviders/dataproviderapi/interface/mmtpdataproviderframework.h Wed Mar 31 22:58:56 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 Mon Mar 15 12:43:12 2010 +0200
+++ b/mtpfws/mtpfw/dataproviders/devdp/group/mtpdevicedp.mmp Wed Mar 31 22:58:56 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 Mon Mar 15 12:43:12 2010 +0200
+++ b/mtpfws/mtpfw/dataproviders/devdp/inc/cmtpgetnumobjects.h Wed Mar 31 22:58:56 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 Mon Mar 15 12:43:12 2010 +0200
+++ b/mtpfws/mtpfw/dataproviders/devdp/inc/mtpdevicedpconst.h Wed Mar 31 22:58:56 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 Mon Mar 15 12:43:12 2010 +0200
+++ b/mtpfws/mtpfw/dataproviders/devdp/src/cmtpdevicedatastore.cpp Wed Mar 31 22:58:56 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 Mon Mar 15 12:43:12 2010 +0200
+++ b/mtpfws/mtpfw/dataproviders/devdp/src/cmtpdevicedp.cpp Wed Mar 31 22:58:56 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 Mon Mar 15 12:43:12 2010 +0200
+++ b/mtpfws/mtpfw/dataproviders/devdp/src/cmtpgetdevicepropdesc.cpp Wed Mar 31 22:58:56 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 Mon Mar 15 12:43:12 2010 +0200
+++ b/mtpfws/mtpfw/dataproviders/devdp/src/cmtpgetnumobjects.cpp Wed Mar 31 22:58:56 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 Mon Mar 15 12:43:12 2010 +0200
+++ b/mtpfws/mtpfw/dataproviders/devdp/src/cmtpgetobjecthandles.cpp Wed Mar 31 22:58:56 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 Mon Mar 15 12:43:12 2010 +0200
+++ b/mtpfws/mtpfw/dataproviders/devdp/src/cmtpgetstorageinfo.cpp Wed Mar 31 22:58:56 2010 +0300
@@ -12,7 +12,7 @@
//
// Description:
//
-
+#include <centralrepository.h>
#include <mtp/tmtptyperequest.h>
#include <mtp/mmtpdataproviderframework.h>
#include <mtp/mmtpobjectmgr.h>
@@ -25,6 +25,11 @@
#include "mtpdevdppanic.h"
#include "rmtpdevicedpsingletons.h"
#include "cmtpdevicedpconfigmgr.h"
+#include "mtpframeworkconst.h"
+
+//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");)
@@ -167,6 +172,7 @@
void CMTPGetStorageInfo::SetStorageTypeL()
{
TUint16 storageType = EMTPStorageUndefined;
+
switch(iDriveInfo.iType)
{
case EMediaNotPresent:
@@ -189,7 +195,14 @@
case EMediaFlash:
case EMediaRemote:
case EMediaFloppy:
- storageType = EMTPStorageRemovableRAM;
+ if (iDriveInfo.iDriveAtt & KDriveAttRemovable)
+ {
+ storageType = EMTPStorageRemovableRAM;
+ }
+ else
+ {
+ storageType = EMTPStorageFixedRAM;
+ }
break;
default:
break;
@@ -239,11 +252,43 @@
*/
void CMTPGetStorageInfo::SetFreeSpaceInBytesL()
{
- TMTPTypeUint64 mtpFreeSpace(iVolumeInfo.iFree);
+ TMTPTypeUint64 mtpFreeSpace;
if(iIsCDrive)
- {
- mtpFreeSpace.Set(0);
- }
+ {
+ mtpFreeSpace.Set(0);
+ }
+ 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 > thresholdValue) ?
+ (iVolumeInfo.iFree - thresholdValue) : 0;
+ mtpFreeSpace.Set(free);
+ __FLOG_1(_L8("set free:%ld"),free);
+ }
+
+ __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 Mon Mar 15 12:43:12 2010 +0200
+++ b/mtpfws/mtpfw/dataproviders/devdp/src/cmtpopensession.cpp Wed Mar 31 22:58:56 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 Mon Mar 15 12:43:12 2010 +0200
+++ b/mtpfws/mtpfw/dataproviders/devdp/src/cmtpresetdevicepropvalue.cpp Wed Mar 31 22:58:56 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 Mon Mar 15 12:43:12 2010 +0200
+++ b/mtpfws/mtpfw/dataproviders/devdp/src/mtpdevicedp_config.rss Wed Mar 31 22:58:56 2010 +0300
@@ -44,7 +44,6 @@
"?:\\resource",
"?:\\sys",
"?:\\system",
- "?:\\logs",
"z:\\"
};
}
--- a/mtpfws/mtpfw/dataproviders/dputility/bwins/mtpdataproviderutilityu.def Mon Mar 15 12:43:12 2010 +0200
+++ b/mtpfws/mtpfw/dataproviders/dputility/bwins/mtpdataproviderutilityu.def Wed Mar 31 22:58:56 2010 +0300
@@ -202,4 +202,15 @@
?NewL@CMTPGetInterDependentPropDesc@@SAPAVMMTPRequestProcessor@@AAVMMTPDataProviderFramework@@AAVMMTPConnection@@@Z @ 201 NONAME ; class MMTPRequestProcessor * CMTPGetInterDependentPropDesc::NewL(class MMTPDataProviderFramework &, class MMTPConnection &)
??1CMTPGetInterDependentPropDesc@@UAE@XZ @ 202 NONAME ; CMTPGetInterDependentPropDesc::~CMTPGetInterDependentPropDesc(void)
?StartL@CMTPFSEnumerator@@QAEXKH@Z @ 203 NONAME ; void CMTPFSEnumerator::StartL(unsigned long, int)
+ ?SetFileEntry@CMTPFSEntryCache@@QAEXABVTEntry@@@Z @ 204 NONAME ; void CMTPFSEntryCache::SetFileEntry(class TEntry const &)
+ ??1CMTPFSEntryCache@@UAE@XZ @ 205 NONAME ; CMTPFSEntryCache::~CMTPFSEntryCache(void)
+ ?SetOnGoing@CMTPFSEntryCache@@QAEXH@Z @ 206 NONAME ; void CMTPFSEntryCache::SetOnGoing(int)
+ ?MovingBigFileCache@RMTPDpSingletons@@QBEAAVCMTPFSEntryCache@@XZ @ 207 NONAME ; class CMTPFSEntryCache & RMTPDpSingletons::MovingBigFileCache(void) const
+ ?CopyingBigFileCache@RMTPDpSingletons@@QBEAAVCMTPFSEntryCache@@XZ @ 208 NONAME ; class CMTPFSEntryCache & RMTPDpSingletons::CopyingBigFileCache(void) const
+ ?IsOnGoing@CMTPFSEntryCache@@QBEHXZ @ 209 NONAME ; int CMTPFSEntryCache::IsOnGoing(void) const
+ ?SetTargetHandle@CMTPFSEntryCache@@QAEXK@Z @ 210 NONAME ; void CMTPFSEntryCache::SetTargetHandle(unsigned long)
+ ?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 Mon Mar 15 12:43:12 2010 +0200
+++ b/mtpfws/mtpfw/dataproviders/dputility/eabi/mtpdataproviderutilityu.def Wed Mar 31 22:58:56 2010 +0300
@@ -400,4 +400,19 @@
_ZTI29CMTPGetInterDependentPropDesc @ 399 NONAME
_ZTV29CMTPGetInterDependentPropDesc @ 400 NONAME
_ZN16CMTPFSEnumerator6StartLEmi @ 401 NONAME
+ _ZN16CMTPFSEntryCache10SetOnGoingEi @ 402 NONAME
+ _ZN16CMTPFSEntryCache12SetFileEntryERK6TEntry @ 403 NONAME
+ _ZN16CMTPFSEntryCache15SetTargetHandleEm @ 404 NONAME
+ _ZN16CMTPFSEntryCache4NewLEv @ 405 NONAME
+ _ZN16CMTPFSEntryCache9FileEntryEv @ 406 NONAME
+ _ZN16CMTPFSEntryCacheD0Ev @ 407 NONAME
+ _ZN16CMTPFSEntryCacheD1Ev @ 408 NONAME
+ _ZN16CMTPFSEntryCacheD2Ev @ 409 NONAME
+ _ZNK16CMTPFSEntryCache12TargetHandleEv @ 410 NONAME
+ _ZNK16CMTPFSEntryCache9IsOnGoingEv @ 411 NONAME
+ _ZNK16RMTPDpSingletons18MovingBigFileCacheEv @ 412 NONAME
+ _ZNK16RMTPDpSingletons19CopyingBigFileCacheEv @ 413 NONAME
+ _ZTI16CMTPFSEntryCache @ 414 NONAME
+ _ZTV16CMTPFSEntryCache @ 415 NONAME
+ _ZN20CMTPRequestProcessor22RegisterPendingRequestEj @ 416 NONAME
--- a/mtpfws/mtpfw/dataproviders/dputility/group/mtpdataproviderutility.mmp Mon Mar 15 12:43:12 2010 +0200
+++ b/mtpfws/mtpfw/dataproviders/dputility/group/mtpdataproviderutility.mmp Wed Mar 31 22:58:56 2010 +0300
@@ -76,7 +76,8 @@
SOURCE cmtpfullenumservicehandler.cpp
SOURCE cmtpcommonrequestprocessor.cpp
SOURCE cmtpgetpartialobject.cpp
-SOURCE cmtpsetobjectprotection.cpp
+SOURCE cmtpsetobjectprotection.cpp
+SOURCE cmtpfsentrycache.cpp
LIBRARY euser.lib
LIBRARY bafl.lib
--- a/mtpfws/mtpfw/dataproviders/dputility/inc/cmtpcopyobject.h Mon Mar 15 12:43:12 2010 +0200
+++ b/mtpfws/mtpfw/dataproviders/dputility/inc/cmtpcopyobject.h Wed Mar 31 22:58:56 2010 +0300
@@ -24,12 +24,15 @@
#include "rmtpframework.h"
#include "cmtprequestprocessor.h"
#include "mtpdebug.h"
+#include "rmtpdpsingletons.h"
class RFs;
class CFileMan;
class CMTPObjectMetaData;
class CMTPObjectPropertyMgr;
+const TInt KCopyObjectTimeOut = 180000000; // 180s
+
/**
Defines data provider CopyObject request processor
@@ -53,6 +56,8 @@
private: //from CMTPRequestProcessor
virtual void ServiceL();
TMTPResponseCode CheckRequestL();
+ TBool DoHandleCompletingPhaseL();
+ TBool Match(const TMTPTypeRequest& aRequest, MMTPConnection& aConnection) const;
private:
void ConstructL();
@@ -62,19 +67,26 @@
TMTPResponseCode CanCopyObjectL(const TDesC& aOldName, const TDesC& aNewName) const;
void GetPreviousPropertiesL(const TDesC& aFileName);
void SetPreviousPropertiesL(const TDesC& aFileName);
- TUint32 CopyFileL(const TDesC& aNewFileName);
+ void CopyFileL(const TDesC& aNewFileName);
TUint32 CopyFolderL(const TDesC& aNewFolderName);
void SetPropertiesL(TUint32 aSourceHandle, const CMTPObjectMetaData& aTargetObject);
TUint32 UpdateObjectInfoL(const TDesC& aNewObject);
+ static TInt OnTimeoutL(TAny* aPtr);
+ void DoOnTimeoutL();
+ void RunL();
private:
- CFileMan* iFileMan;
+ CFileMan* iFileMan;
CMTPObjectMetaData* iObjectInfo; //Not owned.
- HBufC* iDest;
- TUint32 iNewParentHandle;
- TUint32 iStorageId;
- TTime iPreviousModifiedTime;
- RMTPFramework iSingletons;
+ HBufC* iDest;
+ HBufC* iNewFileName;
+ TBool iIsFolder;
+ TUint32 iNewParentHandle;
+ TUint32 iStorageId;
+ TTime iPreviousModifiedTime;
+ RMTPFramework iSingletons;
+ RMTPDpSingletons iDpSingletons;
+ CPeriodic* iTimer;
/**
FLOGGER debug trace member variable.
*/
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mtpfws/mtpfw/dataproviders/dputility/inc/cmtpfsentrycache.h Wed Mar 31 22:58:56 2010 +0300
@@ -0,0 +1,74 @@
+// Copyright (c) 2006-2009 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:
+//
+
+/**
+ @file
+ @internalTechnology
+*/
+
+#ifndef CMTPFSENTRYCACHE_H
+#define CMTPFSENTRYCACHE_H
+
+#include <f32file.h>
+#include "mtpdebug.h"
+
+/**
+This class is used to cache the fs entry information of the big file (>1G) which is being
+copied/moved in fs. The cache information is used to send response to getobjectproplist
+and getobjectinfo
+
+@internalTechnology
+*/
+class CMTPFSEntryCache : public CBase
+ {
+public:
+ IMPORT_C static CMTPFSEntryCache* NewL();
+ IMPORT_C ~CMTPFSEntryCache();
+
+ IMPORT_C TBool IsOnGoing() const;
+ IMPORT_C void SetOnGoing(TBool aOnGoing);
+ IMPORT_C TUint32 TargetHandle() const;
+ IMPORT_C void SetTargetHandle(TUint32 aHandle);
+ IMPORT_C TEntry& FileEntry();
+ IMPORT_C void SetFileEntry(const TEntry& aEntry);
+
+private:
+ CMTPFSEntryCache();
+ void ConstructL();
+
+private:
+ /**
+ Indicate if a big file copy/move is ongoing
+ */
+ TBool iIsOngoing;
+
+ /**
+ The handle of target big file that is being copied/moved
+ */
+ TUint32 iTargetHandle;
+
+ /**
+ The fake file entry of target big file that is being copied/moved
+ Since the target big file is not created in file system, this fake entry is
+ used to return to getobjectproplist and getobjectinfo operations
+ */
+ TEntry iFileEntry;
+ /**
+ FLOGGER debug trace member variable.
+ */
+ __FLOG_DECLARATION_MEMBER_MUTABLE;
+ };
+
+#endif // CMTPFSENTRYCACHE_H
--- a/mtpfws/mtpfw/dataproviders/dputility/inc/cmtpfsenumerator.h Mon Mar 15 12:43:12 2010 +0200
+++ b/mtpfws/mtpfw/dataproviders/dputility/inc/cmtpfsenumerator.h Wed Mar 31 22:58:56 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/cmtpgetobjectinfo.h Mon Mar 15 12:43:12 2010 +0200
+++ b/mtpfws/mtpfw/dataproviders/dputility/inc/cmtpgetobjectinfo.h Wed Mar 31 22:58:56 2010 +0300
@@ -59,7 +59,11 @@
CMTPTypeObjectInfo* iObjectInfoToBuild;
TEntry iFileEntry;
RFs& iRfs;
- RMTPDpSingletons iDpSingletons;
+ RMTPDpSingletons iDpSingletons;
+ /**
+ FLOGGER debug trace member variable.
+ */
+ __FLOG_DECLARATION_MEMBER_MUTABLE;
};
#endif CMTPGETOBJECTINFO_H
--- a/mtpfws/mtpfw/dataproviders/dputility/inc/cmtpgetobjectproplist.h Mon Mar 15 12:43:12 2010 +0200
+++ b/mtpfws/mtpfw/dataproviders/dputility/inc/cmtpgetobjectproplist.h Wed Mar 31 22:58:56 2010 +0300
@@ -69,8 +69,12 @@
CMTPTypeArray* iHandles;
CMTPTypeObjectPropList* iPropertyList;
RMTPDpSingletons iDpSingletons;
- CMTPObjectMetaData* iObjMeta;
- TEntry iFileEntry;
+ CMTPObjectMetaData* iObjMeta;
+ TEntry iFileEntry;
+ /**
+ FLOGGER debug trace member variable.
+ */
+ __FLOG_DECLARATION_MEMBER_MUTABLE;
};
#endif // CMTPGETOBJECTPROPLIST_H
--- a/mtpfws/mtpfw/dataproviders/dputility/inc/cmtprequestchecker.h Mon Mar 15 12:43:12 2010 +0200
+++ b/mtpfws/mtpfw/dataproviders/dputility/inc/cmtprequestchecker.h Wed Mar 31 22:58:56 2010 +0300
@@ -27,6 +27,7 @@
#include <mtp/mtpprotocolconstants.h>
#include <mtp/tmtptyperequest.h>
#include "mtpdebug.h"
+#include "rmtpdpsingletons.h"
class CMTPObjectMetaData;
class MMTPDataProviderFramework;
@@ -138,12 +139,14 @@
TBool IsSpecialValue(TUint32 aParameter, const TMTPRequestElementInfo& aElementInfo) const;
private:
CMTPRequestChecker(MMTPDataProviderFramework& aFramework, MMTPConnection& aConnection);
+ void ConstructL();
private:
MMTPDataProviderFramework& iFramework;
MMTPConnection& iConnection;
RArray<TUint32> iHandles; //these two arrays contain the mapping from the handle to objectinfo
- RPointerArray<CMTPObjectMetaData> iObjectArray;
+ RPointerArray<CMTPObjectMetaData> iObjectArray;
+ RMTPDpSingletons iDpSingletons;
/**
FLOGGER debug trace member variable.
*/
--- a/mtpfws/mtpfw/dataproviders/dputility/inc/cmtprequestprocessor.h Mon Mar 15 12:43:12 2010 +0200
+++ b/mtpfws/mtpfw/dataproviders/dputility/inc/cmtprequestprocessor.h Wed Mar 31 22:58:56 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/cmtpsendobjectinfo.h Mon Mar 15 12:43:12 2010 +0200
+++ b/mtpfws/mtpfw/dataproviders/dputility/inc/cmtpsendobjectinfo.h Wed Mar 31 22:58:56 2010 +0300
@@ -73,8 +73,7 @@
TBool DoHandleSendObjectCompleteL();
TBool GetFullPathNameL(const TDesC& aFileName);
-
- TBool CanStoreFileL(TUint32 aStorageId, TInt64 aObjectSize) const;
+
TBool IsTooLarge(TUint64 aObjectSize) const;
TBool Exists(const TDesC& aName) const;
TMTPResponseCode ExtractPropertyL(const CMTPTypeObjectPropListElement& aElement);
--- a/mtpfws/mtpfw/dataproviders/dputility/inc/rmtpdpsingletons.h Mon Mar 15 12:43:12 2010 +0200
+++ b/mtpfws/mtpfw/dataproviders/dputility/inc/rmtpdpsingletons.h Wed Mar 31 22:58:56 2010 +0300
@@ -28,6 +28,8 @@
class MMTPDataProviderFramework;
class CMTPDpConfigMgr;
class CMTPFSExclusionMgr;
+class CMTPFSEntryCache;
+
/**
Implements the MTP data processor singletons reference manager.
@internalComponent
@@ -45,6 +47,8 @@
IMPORT_C void SetExclusionMgrL(CMTPFSExclusionMgr& aExclusionMgr);
IMPORT_C RMTPUtility& MTPUtility() const;
+ IMPORT_C CMTPFSEntryCache& CopyingBigFileCache() const;
+ IMPORT_C CMTPFSEntryCache& MovingBigFileCache() const;
private:
class TExclusionMgrEntry
@@ -93,6 +97,9 @@
* The utility for DPutility
*/
RMTPUtility iMTPUtility;
+
+ CMTPFSEntryCache* iCopyingBigFileCache;
+ CMTPFSEntryCache* iMovingBigFileCache;
};
private: //Not owned
--- a/mtpfws/mtpfw/dataproviders/dputility/src/cmtpcopyobject.cpp Mon Mar 15 12:43:12 2010 +0200
+++ b/mtpfws/mtpfw/dataproviders/dputility/src/cmtpcopyobject.cpp Wed Mar 31 22:58:56 2010 +0300
@@ -23,6 +23,7 @@
#include <mtp/cmtptypearray.h>
#include <mtp/cmtptypestring.h>
+#include "cmtpfsentrycache.h"
#include "cmtpstoragemgr.h"
#include "cmtpcopyobject.h"
#include "mtpdppanic.h"
@@ -61,9 +62,17 @@
*/
EXPORT_C CMTPCopyObject::~CMTPCopyObject()
{
+ __FLOG(_L8("~CMTPCopyObject - Entry"));
+ Cancel();
+ iDpSingletons.Close();
+ iSingletons.Close();
+
+ delete iTimer;
delete iDest;
+ delete iNewFileName;
delete iFileMan;
- iSingletons.Close();
+
+ __FLOG(_L8("~CMTPCopyObject - Exit"));
__FLOG_CLOSE;
}
@@ -71,7 +80,8 @@
Standard c++ constructor
*/
CMTPCopyObject::CMTPCopyObject(MMTPDataProviderFramework& aFramework, MMTPConnection& aConnection) :
- CMTPRequestProcessor(aFramework, aConnection, sizeof(KMTPCopyObjectPolicy)/sizeof(TMTPRequestElementInfo), KMTPCopyObjectPolicy)
+ CMTPRequestProcessor(aFramework, aConnection, sizeof(KMTPCopyObjectPolicy)/sizeof(TMTPRequestElementInfo), KMTPCopyObjectPolicy),
+ iTimer(NULL)
{
__FLOG_OPEN(KMTPSubsystem, KComponent);
}
@@ -80,14 +90,33 @@
TMTPResponseCode CMTPCopyObject::CheckRequestL()
{
- __FLOG(_L8("CheckRequestL - Entry"));
+ __FLOG(_L8("CheckRequestL - Entry"));
TMTPResponseCode result = CMTPRequestProcessor::CheckRequestL();
if ( (EMTPRespCodeOK == result) && (!iSingletons.StorageMgr().IsReadWriteStorage(Request().Uint32(TMTPTypeRequest::ERequestParameter2))) )
{
result = EMTPRespCodeStoreReadOnly;
}
-
- __FLOG(_L8("CheckRequestL - Exit"));
+ if(result == EMTPRespCodeOK)
+ {
+ const TUint32 KHandle(Request().Uint32(TMTPTypeRequest::ERequestParameter1));
+ CMTPObjectMetaData* object(CMTPObjectMetaData::NewLC());
+ if(iFramework.ObjectMgr().ObjectL(KHandle, *object))
+ {
+ const TDesC& suid(object->DesC(CMTPObjectMetaData::ESuid));
+ iIsFolder = EFalse;
+ User::LeaveIfError(BaflUtils::IsFolder(iFramework.Fs(), suid, iIsFolder));
+ if(!iIsFolder)
+ {
+ if(iDpSingletons.CopyingBigFileCache().IsOnGoing())
+ {
+ __FLOG(_L8("CheckRequestL - A big file copying is ongoing, respond with access denied"));
+ result = EMTPRespCodeAccessDenied;
+ }
+ }
+ }
+ CleanupStack::PopAndDestroy(object);
+ }
+ __FLOG(_L8("CheckRequestL - Exit"));
return result;
}
@@ -96,16 +125,20 @@
*/
void CMTPCopyObject::ServiceL()
{
+ __FLOG(_L8("ServiceL - Entry"));
TUint32 handle = KMTPHandleNone;
TMTPResponseCode responseCode = CopyObjectL(handle);
- if(responseCode == EMTPRespCodeOK)
+ if(responseCode != EMTPRespCodeOK)
{
+ __FLOG_VA((_L8("ServiceL, sending response with respond code %d"), responseCode));
+ SendResponseL(responseCode);
+ }
+ else if (iIsFolder)
+ {
+ __FLOG_VA((_L8("ServiceL, sending response with handle=%d, respond code OK"), handle));
SendResponseL(EMTPRespCodeOK, 1, &handle);
}
- else
- {
- SendResponseL(responseCode);
- }
+ __FLOG(_L8("ServiceL - Exit"));
}
@@ -113,9 +146,10 @@
Second phase constructor
*/
void CMTPCopyObject::ConstructL()
- {
+ {
iSingletons.OpenL();
- }
+ iDpSingletons.OpenL(iFramework);
+ }
/**
@@ -123,19 +157,28 @@
@param aNewFileName the new full filename after copy.
@return objectHandle of new copy of object.
*/
-TUint32 CMTPCopyObject::CopyFileL(const TDesC& aNewFileName)
+void CMTPCopyObject::CopyFileL(const TDesC& aNewFileName)
{
__FLOG(_L8("CopyFileL - Entry"));
+ delete iNewFileName;
+ iNewFileName = NULL;
+ iNewFileName = aNewFileName.AllocL(); // Store the new file name
const TDesC& suid(iObjectInfo->DesC(CMTPObjectMetaData::ESuid));
GetPreviousPropertiesL(suid);
- User::LeaveIfError(iFileMan->Copy(suid, *iDest));
- SetPreviousPropertiesL(aNewFileName);
- TUint32 handle = UpdateObjectInfoL(aNewFileName);
+ User::LeaveIfError(iFileMan->Copy(suid, *iDest, CFileMan::EOverWrite, iStatus));
+ if ( !IsActive() )
+ {
+ SetActive();
+ }
+
+ delete iTimer;
+ iTimer = NULL;
+ iTimer = CPeriodic::NewL(EPriorityStandard);
+ TTimeIntervalMicroSeconds32 KCopyObjectIntervalNone = 0;
+ iTimer->Start(TTimeIntervalMicroSeconds32(KCopyObjectTimeOut), KCopyObjectIntervalNone, TCallBack(CMTPCopyObject::OnTimeoutL, this));
__FLOG(_L8("CopyFileL - Exit"));
-
- return handle;
}
/**
@@ -183,11 +226,7 @@
const TDesC& suid(iObjectInfo->DesC(CMTPObjectMetaData::ESuid));
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())
{
@@ -213,9 +252,9 @@
iFileMan = NULL;
iFileMan = CFileMan::NewL(iFramework.Fs());
- if(!isFolder) // It is a file.
+ if(!iIsFolder) // It is a file.
{
- aNewHandle = CopyFileL(newObjectName);
+ CopyFileL(newObjectName);
}
else // It is a folder.
{
@@ -357,3 +396,122 @@
return handle;
}
+
+/**
+ Call back function, called when the timer expired for big file copying.
+ Send response to initiator and cache the target file entry info, which is used to send response
+ to getobjectproplist and getobjectinfo.
+*/
+TInt CMTPCopyObject::OnTimeoutL(TAny* aPtr)
+ {
+ CMTPCopyObject* copyObjectProcessor = static_cast<CMTPCopyObject*>(aPtr);
+ copyObjectProcessor->DoOnTimeoutL();
+ return KErrNone;
+ }
+
+void CMTPCopyObject::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 = KMTPHandleNone;
+ handle = UpdateObjectInfoL(*iNewFileName);
+ CMTPFSEntryCache& aCache = iDpSingletons.CopyingBigFileCache();
+
+ // 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_VA((_L8("UpdateFSEntryCache, sending response with handle=%d, respond code OK for a big file copy"), handle));
+ SendResponseL(EMTPRespCodeOK, 1, &handle);
+
+ __FLOG(_L8("DoOnTimeoutL - Exit"));
+ }
+
+/**
+ CMTPCopyObject::RunL
+*/
+void CMTPCopyObject::RunL()
+ {
+ __FLOG(_L8("RunL - Entry"));
+
+ User::LeaveIfError(iStatus.Int());
+ SetPreviousPropertiesL(*iNewFileName);
+ CMTPFSEntryCache& aCache = iDpSingletons.CopyingBigFileCache();
+ // Check to see if we are copying a big file
+ if(aCache.IsOnGoing())
+ {
+ __FLOG(_L8("RunL - Big file copy complete"));
+ aCache.SetOnGoing(EFalse);
+ aCache.SetTargetHandle(KMTPHandleNone);
+ }
+ else
+ {
+ //Cancel the timer
+ if(iTimer)
+ {
+ if (iTimer->IsActive())
+ {
+ iTimer->Cancel();
+ }
+ delete iTimer;
+ iTimer = NULL;
+ }
+
+ TUint32 handle = UpdateObjectInfoL(*iNewFileName);
+ __FLOG_VA((_L8("RunL, sending response with handle=%d, respond code OK for a normal file copy"), handle));
+ SendResponseL(EMTPRespCodeOK, 1, &handle);
+ }
+ __FLOG(_L8("RunL - Exit"));
+ }
+
+/**
+Override to handle the complete phase of copy object
+@return EFalse
+*/
+TBool CMTPCopyObject::DoHandleCompletingPhaseL()
+ {
+ CMTPRequestProcessor::DoHandleCompletingPhaseL();
+
+ CMTPFSEntryCache& aCache = iDpSingletons.CopyingBigFileCache();
+ if(aCache.IsOnGoing())
+ {
+ return EFalse;
+ }
+ else
+ {
+ return ETrue;
+ }
+ }
+
+/**
+Override to match CopyObject 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 CMTPCopyObject::Match(const TMTPTypeRequest& aRequest, MMTPConnection& aConnection) const
+ {
+ __FLOG(_L8("Match - Entry"));
+ TBool result = EFalse;
+ TUint16 operationCode = aRequest.Uint16(TMTPTypeRequest::ERequestOperationCode);
+ if ((operationCode == EMTPOpCodeCopyObject) && &iConnection == &aConnection)
+ {
+ result = ETrue;
+ }
+ __FLOG_VA((_L8("Match -- Exit with result = %d"), result));
+ return result;
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mtpfws/mtpfw/dataproviders/dputility/src/cmtpfsentrycache.cpp Wed Mar 31 22:58:56 2010 +0300
@@ -0,0 +1,89 @@
+// Copyright (c) 2006-2009 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:
+//
+
+#include <mtp/mtpprotocolconstants.h>
+
+#include "cmtpfsentrycache.h"
+
+
+__FLOG_STMT(_LIT8(KComponent,"MTPFSEntryCache");)
+
+// -----------------------------------------------------------------------------
+// CMTPFSEntryCache::NewL
+// Two-phase construction method
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CMTPFSEntryCache* CMTPFSEntryCache::NewL()
+ {
+ CMTPFSEntryCache* self = new (ELeave) CMTPFSEntryCache();
+ CleanupStack::PushL(self);
+ self->ConstructL();
+ CleanupStack::Pop(self);
+ return self;
+ }
+
+EXPORT_C CMTPFSEntryCache::~CMTPFSEntryCache()
+ {
+ __FLOG(_L8("~CMTPFSEntryCache - Entry"));
+ __FLOG(_L8("~CMTPFSEntryCache - Exit"));
+ __FLOG_CLOSE;
+ }
+
+EXPORT_C TBool CMTPFSEntryCache::IsOnGoing() const
+ {
+ return iIsOngoing;
+ }
+
+EXPORT_C void CMTPFSEntryCache::SetOnGoing(TBool aOnGoing)
+ {
+ __FLOG(_L8("SetOnGoing - Entry"));
+ iIsOngoing = aOnGoing;
+ __FLOG(_L8("SetOnGoing - Exit"));
+ }
+
+EXPORT_C TUint32 CMTPFSEntryCache::TargetHandle() const
+ {
+ return iTargetHandle;
+ }
+
+EXPORT_C void CMTPFSEntryCache::SetTargetHandle(TUint32 aHandle)
+ {
+ __FLOG(_L8("SetTargetHandle - Entry"));
+ iTargetHandle = aHandle;
+ __FLOG(_L8("SetTargetHandle - Exit"));
+ }
+
+EXPORT_C TEntry& CMTPFSEntryCache::FileEntry()
+ {
+ return iFileEntry;
+ }
+
+EXPORT_C void CMTPFSEntryCache::SetFileEntry(const TEntry& aEntry)
+ {
+ __FLOG(_L8("SetFileEntry - Entry"));
+ iFileEntry = aEntry;
+ __FLOG(_L8("SetFileEntry - Exit"));
+ }
+
+CMTPFSEntryCache::CMTPFSEntryCache():iIsOngoing(EFalse), iTargetHandle(KMTPHandleNone)
+ {
+ __FLOG_OPEN(KMTPSubsystem, KComponent);
+ __FLOG(_L8("CMTPFSEntryCache - Entry"));
+ __FLOG(_L8("CMTPFSEntryCache - Exit"));
+ }
+
+void CMTPFSEntryCache::ConstructL()
+ {
+ }
--- a/mtpfws/mtpfw/dataproviders/dputility/src/cmtpfsenumerator.cpp Mon Mar 15 12:43:12 2010 +0200
+++ b/mtpfws/mtpfw/dataproviders/dputility/src/cmtpfsenumerator.cpp Wed Mar 31 22:58:56 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/cmtpgetobject.cpp Mon Mar 15 12:43:12 2010 +0200
+++ b/mtpfws/mtpfw/dataproviders/dputility/src/cmtpgetobject.cpp Wed Mar 31 22:58:56 2010 +0300
@@ -99,17 +99,24 @@
// The object handle has already been checked, so an invalid handle can
// only occur if it was invalidated during a context switch between
// the validation time and now.
- iError = EMTPRespCodeInvalidObjectHandle;
+ SendResponseL(EMTPRespCodeInvalidObjectHandle);
}
else if ( objectInfo->Uint(CMTPObjectMetaData::EFormatCode)==EMTPFormatCodeAssociation
&& objectInfo->Uint(CMTPObjectMetaData::EFormatSubCode)==EMTPAssociationTypeGenericFolder)
{
- iError = EMTPRespCodeInvalidObjectHandle;
+ SendResponseL(EMTPRespCodeInvalidObjectHandle);
}
else
{
- BuildFileObjectL(objectInfo->DesC(CMTPObjectMetaData::ESuid));
- SendDataL(*iFileObject);
+ TRAPD(err, BuildFileObjectL(objectInfo->DesC(CMTPObjectMetaData::ESuid)));
+ if (err == KErrNone)
+ {
+ SendDataL(*iFileObject);
+ }
+ else
+ {
+ SendResponseL(EMTPRespCodeAccessDenied);
+ }
}
__FLOG(_L8("ServiceL - Exit"));
}
--- a/mtpfws/mtpfw/dataproviders/dputility/src/cmtpgetobjectinfo.cpp Mon Mar 15 12:43:12 2010 +0200
+++ b/mtpfws/mtpfw/dataproviders/dputility/src/cmtpgetobjectinfo.cpp Wed Mar 31 22:58:56 2010 +0300
@@ -23,6 +23,9 @@
#include "cmtpgetobjectinfo.h"
#include "mtpdppanic.h"
+#include "cmtpfsentrycache.h"
+
+__FLOG_STMT(_LIT8(KComponent,"MTPGetObjectInfo");)
/**
Verification data for GetObjectInfo request
@@ -55,6 +58,7 @@
{
delete iObjectInfoToBuild;
iDpSingletons.Close();
+ __FLOG_CLOSE;
}
/**
@@ -65,6 +69,7 @@
:CMTPRequestProcessor(aFramework, aConnection, sizeof(KMTPGetObjectInfoPolicy)/sizeof(TMTPRequestElementInfo), KMTPGetObjectInfoPolicy),
iRfs(aFramework.Fs())
{
+ __FLOG_OPEN(KMTPSubsystem, KComponent);
}
/**
@@ -97,7 +102,29 @@
__ASSERT_DEBUG(objectInfoFromStore, Panic(EMTPDpObjectNull));
TEntry fileEntry;
- User::LeaveIfError(iRfs.Entry(objectInfoFromStore->DesC(CMTPObjectMetaData::ESuid), fileEntry));
+ TInt err = iRfs.Entry(objectInfoFromStore->DesC(CMTPObjectMetaData::ESuid), fileEntry);
+
+ if ( err != KErrNone )
+ {
+ if( (iDpSingletons.CopyingBigFileCache().TargetHandle() == objectHandle) &&
+ (iDpSingletons.CopyingBigFileCache().IsOnGoing()))
+ {
+ // The object is being copied, it is not created in fs yet. Use its cache entry to get objectinfo
+ __FLOG(_L8("BuildObjectInfoL - The object is being copied, use its cache entry to get objectinfo"));
+ fileEntry = iDpSingletons.CopyingBigFileCache().FileEntry();
+ err = KErrNone;
+ }
+ else if( (iDpSingletons.MovingBigFileCache().TargetHandle() == objectHandle) &&
+ (iDpSingletons.MovingBigFileCache().IsOnGoing()))
+ {
+ // The object is being moved, it is not created in fs yet. Use its cache entry to get objectinfo
+ __FLOG(_L8("BuildObjectInfoL - The object is being moved, use its cache entry to get objectinfo"));
+ fileEntry = iDpSingletons.MovingBigFileCache().FileEntry();
+ err = KErrNone;
+ }
+ }
+
+ User::LeaveIfError(err);
//1. storage id
iObjectInfoToBuild->SetUint32L(CMTPTypeObjectInfo::EStorageID, objectInfoFromStore->Uint(CMTPObjectMetaData::EStorageId));
--- a/mtpfws/mtpfw/dataproviders/dputility/src/cmtpgetobjectproplist.cpp Mon Mar 15 12:43:12 2010 +0200
+++ b/mtpfws/mtpfw/dataproviders/dputility/src/cmtpgetobjectproplist.cpp Wed Mar 31 22:58:56 2010 +0300
@@ -27,6 +27,9 @@
#include "cmtpfsexclusionmgr.h"
#include "mtpdpconst.h"
#include "mtpdppanic.h"
+#include "cmtpfsentrycache.h"
+
+__FLOG_STMT(_LIT8(KComponent,"MTPGetObjectPropList");)
/**
Verification data for the GetNumObjects request
@@ -51,11 +54,13 @@
delete iPropertyList;
iDpSingletons.Close();
delete iObjMeta;
+ __FLOG_CLOSE;
}
void CMTPGetObjectPropList::ServiceL()
- {
- TUint32 propCode(Request().Uint32(TMTPTypeRequest::ERequestParameter3));
+ {
+ __FLOG(_L8("ServiceL - Entry"));
+ TUint32 propCode(Request().Uint32(TMTPTypeRequest::ERequestParameter3));
TUint32 groupCode(Request().Uint32(TMTPTypeRequest::ERequestParameter4));
if( ( propCode != 0 ) || ( (groupCode !=0) && (groupCode <= KMTPDpPropertyGroupNumber) ) )
@@ -66,8 +71,30 @@
{
TUint32 handle(iHandles->ElementUint(i));
iFramework.ObjectMgr().ObjectL(handle, *iObjMeta);
- TFileName file(iObjMeta->DesC(CMTPObjectMetaData::ESuid));
- User::LeaveIfError(iFramework.Fs().Entry(iObjMeta->DesC(CMTPObjectMetaData::ESuid), iFileEntry));
+
+ TInt err = iFramework.Fs().Entry(iObjMeta->DesC(CMTPObjectMetaData::ESuid), iFileEntry);
+
+ if ( err != KErrNone )
+ {
+ if( (iDpSingletons.CopyingBigFileCache().TargetHandle() == handle) &&
+ (iDpSingletons.CopyingBigFileCache().IsOnGoing()))
+ {
+ // The object is being copied, it is not created in fs yet. Use its cache entry to get properties
+ __FLOG(_L8("ServiceL - The object is being copied, use its cache entry to get properties"));
+ iFileEntry = iDpSingletons.CopyingBigFileCache().FileEntry();
+ err = KErrNone;
+ }
+ else if( (iDpSingletons.MovingBigFileCache().TargetHandle() == handle) &&
+ (iDpSingletons.MovingBigFileCache().IsOnGoing()))
+ {
+ // The object is being moved, it is not created in fs yet. Use its cache entry to get properties
+ __FLOG(_L8("ServiceL - The object is being moved, use its cache entry to get properties"));
+ iFileEntry = iDpSingletons.MovingBigFileCache().FileEntry();
+ err = KErrNone;
+ }
+ }
+
+ User::LeaveIfError(err);
if (propCode == KMaxTUint)
{
@@ -87,9 +114,11 @@
//it means the groupcode is not supported, return EMTPRespCodeGroupNotSupported(0xA805) response.
//but we use one empty ObjectPropList to replace the EMTPRespCodeGroupNotSupported(0xA805) response.
- SendDataL(*iPropertyList);
- }
-
+ SendDataL(*iPropertyList);
+
+ __FLOG(_L8("ServiceL - Exit"));
+ }
+
TMTPResponseCode CMTPGetObjectPropList::CheckRequestL()
{
TMTPResponseCode result = CMTPRequestProcessor::CheckRequestL();
@@ -114,6 +143,7 @@
CMTPGetObjectPropList::CMTPGetObjectPropList(MMTPDataProviderFramework& aFramework, MMTPConnection& aConnection) :
CMTPRequestProcessor(aFramework, aConnection, (sizeof(KMTPGetObjectPropListPolicy) / sizeof(TMTPRequestElementInfo)), KMTPGetObjectPropListPolicy)
{
+ __FLOG_OPEN(KMTPSubsystem, KComponent);
}
void CMTPGetObjectPropList::ConstructL()
--- a/mtpfws/mtpfw/dataproviders/dputility/src/cmtpmoveobject.cpp Mon Mar 15 12:43:12 2010 +0200
+++ b/mtpfws/mtpfw/dataproviders/dputility/src/cmtpmoveobject.cpp Wed Mar 31 22:58:56 2010 +0300
@@ -113,8 +113,13 @@
*/
void CMTPMoveObject::ServiceL()
{
- TMTPResponseCode ret = MoveObjectL();
- if (EMTPRespCodeOK != ret)
+ TMTPResponseCode ret = EMTPRespCodeOK;
+ TRAPD(err, ret = MoveObjectL());
+ if (err != KErrNone)
+ {
+ SendResponseL(EMTPRespCodeAccessDenied);
+ }
+ else if (EMTPRespCodeOK != ret)
{
SendResponseL(ret);
}
--- a/mtpfws/mtpfw/dataproviders/dputility/src/cmtprequestchecker.cpp Mon Mar 15 12:43:12 2010 +0200
+++ b/mtpfws/mtpfw/dataproviders/dputility/src/cmtprequestchecker.cpp Wed Mar 31 22:58:56 2010 +0300
@@ -21,8 +21,8 @@
#include <mtp/mmtpstoragemgr.h>
#include "cmtprequestchecker.h"
-#include "rmtpdpsingletons.h"
#include "cmtpfsexclusionmgr.h"
+#include "cmtpfsentrycache.h"
static const TInt KMTPRequestCheckerHandleGranularity = 2;
__FLOG_STMT(_LIT8(KComponent,"MTPRequestChecker");)
@@ -36,6 +36,9 @@
EXPORT_C CMTPRequestChecker* CMTPRequestChecker::NewL(MMTPDataProviderFramework& aFramework, MMTPConnection& aConnection)
{
CMTPRequestChecker* self = new (ELeave) CMTPRequestChecker(aFramework, aConnection);
+ CleanupStack::PushL(self);
+ self->ConstructL();
+ CleanupStack::Pop(self);
return self;
}
@@ -44,6 +47,7 @@
*/
EXPORT_C CMTPRequestChecker::~CMTPRequestChecker()
{
+ iDpSingletons.Close();
iHandles.Close();
iObjectArray.ResetAndDestroy();
__FLOG_CLOSE;
@@ -215,6 +219,11 @@
if (result)
{
TUint storageID = object->Uint(CMTPObjectMetaData::EStorageId);
+ if(!iFramework.StorageMgr().ValidStorageId(storageID))
+ {
+ return EMTPRespCodeInvalidObjectHandle;
+ }
+
CMTPStorageMetaData* storageMetaData = (CMTPStorageMetaData *)& iFramework.StorageMgr().StorageL(storageID);
if (storageMetaData->Uint(CMTPStorageMetaData::EStorageSystemType) != CMTPStorageMetaData::ESystemTypeDefaultFileSystem)
{
@@ -233,6 +242,25 @@
}
else
{
+ if ( err != KErrNone )
+ {
+ if( (iDpSingletons.CopyingBigFileCache().TargetHandle() == aHandle) &&
+ (iDpSingletons.CopyingBigFileCache().IsOnGoing()))
+ {
+ // The object is being copied, it is not created in fs yet. Use its cache entry for check
+ __FLOG(_L8("VerifyObjectHandleL - The object is being copied, use its cache entry for check"));
+ entry = iDpSingletons.CopyingBigFileCache().FileEntry();
+ err = KErrNone;
+ }
+ else if( (iDpSingletons.MovingBigFileCache().TargetHandle() == aHandle) &&
+ (iDpSingletons.MovingBigFileCache().IsOnGoing()))
+ {
+ // The object is being moved, it is not created in fs yet. Use its cache entry for check
+ __FLOG(_L8("VerifyObjectHandleL - The object is being moved, use its cache entry for check"));
+ entry = iDpSingletons.MovingBigFileCache().FileEntry();
+ err = KErrNone;
+ }
+ }
User::LeaveIfError(err);
}
@@ -388,5 +416,12 @@
__FLOG_OPEN(KMTPSubsystem, KComponent);
}
+/**
+ Second phase constructor
+*/
+void CMTPRequestChecker::ConstructL()
+ {
+ iDpSingletons.OpenL(iFramework);
+ }
--- a/mtpfws/mtpfw/dataproviders/dputility/src/cmtprequestprocessor.cpp Mon Mar 15 12:43:12 2010 +0200
+++ b/mtpfws/mtpfw/dataproviders/dputility/src/cmtprequestprocessor.cpp Wed Mar 31 22:58:56 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/cmtpsendobjectinfo.cpp Mon Mar 15 12:43:12 2010 +0200
+++ b/mtpfws/mtpfw/dataproviders/dputility/src/cmtpsendobjectinfo.cpp Wed Mar 31 22:58:56 2010 +0300
@@ -73,7 +73,7 @@
EXPORT_C CMTPSendObjectInfo::~CMTPSendObjectInfo()
{
__FLOG(_L8("~CMTPSendObjectInfo - Entry"));
-
+ __FLOG_2(_L8("iProgress:%d NoRollback:%d"),iProgress,iNoRollback);
if ((iProgress == EObjectInfoSucceed ||
iProgress == EObjectInfoFail ||
iProgress == EObjectInfoInProgress) && !iNoRollback)
@@ -158,12 +158,6 @@
result = EMTPRespCodeObjectTooLarge;
}
- //File size is limited to KMaxTInt64 that is 8ExaBytes
- //if the object size is more,then report this error.
- if (!CanStoreFileL(iStorageId, iObjectSize)||(iObjectSize > (KMaxTInt64)))
- {
- result = EMTPRespCodeStoreFull;
- }
}
}
@@ -313,7 +307,7 @@
result = EFalse;
}
- __FLOG(_L8("DoHandleCompletingPhaseL - Exit"));
+ __FLOG_2(_L8("DoHandleCompletingPhaseL - Exit result:%d progress:%d"),result,iProgress);
return result;
}
@@ -529,11 +523,6 @@
SendResponseL(EMTPRespCodeObjectTooLarge);
result = EFalse;
}
- if(result && !CanStoreFileL(iStorageId, iObjectSize))
- {
- SendResponseL(EMTPRespCodeStoreFull);
- result = EFalse;
- }
}
if (result)
@@ -571,7 +560,9 @@
if (err != KErrNone)
{
+ __FLOG_1(_L8("Fail to create fs object %d"),err);
SendResponseL(ErrorToMTPError(err));
+ result = EFalse;
}
else
{
@@ -640,7 +631,9 @@
if (err != KErrNone)
{
+ __FLOG_1(_L8("Fail to create fs object %d"),err);
SendResponseL(ErrorToMTPError(err));
+ result = EFalse;
}
else
{
@@ -798,31 +791,6 @@
}
/**
-Check if we can store the file on the storage
-@return ETrue if yes, otherwise EFalse
-*/
-TBool CMTPSendObjectInfo::CanStoreFileL(TUint32 aStorageId, TInt64 aObjectSize) const
- {
- __FLOG(_L8("CanStoreFileL - Entry"));
- TBool result(ETrue);
- if (aStorageId == KMTPStorageDefault)
- {
- aStorageId = iFramework.StorageMgr().DefaultStorageId();
- }
- TInt drive( iFramework.StorageMgr().DriveNumber(aStorageId) );
- User::LeaveIfError(drive);
- TVolumeInfo volumeInfo;
- User::LeaveIfError(iFramework.Fs().Volume(volumeInfo, drive));
- if (volumeInfo.iFree < aObjectSize)
- {
- result = EFalse;
- }
- __FLOG_VA((_L8("Result = %d"), result));
- __FLOG(_L8("CanStoreFileL - Exit"));
- return result;
- }
-
-/**
Check if the object is too large
@return ETrue if yes, otherwise EFalse
*/
@@ -1157,14 +1125,16 @@
{
if(iIsFolder)
{
- __FLOG(_L8("It is a folder cancel process."));
+ __FLOG(_L8("Rollback the dir created."));
iFramework.Fs().RmDir(iFullPath);
// If it is folder, delete it from MTP database, i.e ObjectStore.
TRAP_IGNORE(iFramework.ObjectMgr().RemoveObjectL(iFullPath));
}
else
{
- __FLOG(_L8("It is a file cancel process."));
+ __FLOG(_L8("Rollback the file created."));
+ delete iFileReceived;
+ iFileReceived = NULL;
// Delete this object from file system.
iFramework.Fs().Delete(iFullPath);
TRAP_IGNORE(iFramework.ObjectMgr().UnreserveObjectHandleL(*iReceivedObject));
@@ -1188,6 +1158,9 @@
case KErrDiskFull:
resp = EMTPRespCodeStoreFull;
break;
+
+ default:
+ break;
}
return resp;
--- a/mtpfws/mtpfw/dataproviders/dputility/src/rmtpdpsingletons.cpp Mon Mar 15 12:43:12 2010 +0200
+++ b/mtpfws/mtpfw/dataproviders/dputility/src/rmtpdpsingletons.cpp Wed Mar 31 22:58:56 2010 +0300
@@ -14,6 +14,7 @@
//
#include "rmtpdpsingletons.h"
+#include "cmtpfsentrycache.h"
#include <mtp/mmtpdataproviderframework.h>
#include <mtp/cmtpobjectmetadata.h>
@@ -137,6 +138,8 @@
__FLOG(_L8("CSingletons::~CSingletons - Entry"));
iExclusionList.Close();
iMTPUtility.Close();
+ delete iCopyingBigFileCache;
+ delete iMovingBigFileCache;
__FLOG(_L8("CSingletons::~CSingletons - Exit"));
__FLOG_CLOSE;
}
@@ -147,6 +150,8 @@
__FLOG(_L8("CSingletons::ConstructL - Entry"));
iMTPUtility.OpenL(aFramework);
+ iCopyingBigFileCache = CMTPFSEntryCache::NewL();
+ iMovingBigFileCache = CMTPFSEntryCache::NewL();
__FLOG(_L8("CSingletons::ConstructL - Exit"));
}
@@ -155,3 +160,14 @@
{
return iSingletons->iMTPUtility;
}
+
+EXPORT_C CMTPFSEntryCache& RMTPDpSingletons::CopyingBigFileCache() const
+ {
+ return *(iSingletons->iCopyingBigFileCache);
+ }
+
+EXPORT_C CMTPFSEntryCache& RMTPDpSingletons::MovingBigFileCache() const
+ {
+ return *(iSingletons->iMovingBigFileCache);
+ }
+
--- a/mtpfws/mtpfw/dataproviders/proxydp/src/cmtpgetobjectproplist.cpp Mon Mar 15 12:43:12 2010 +0200
+++ b/mtpfws/mtpfw/dataproviders/proxydp/src/cmtpgetobjectproplist.cpp Wed Mar 31 22:58:56 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/datatypes/bwins/mtpdatatypesU.DEF Mon Mar 15 12:43:12 2010 +0200
+++ b/mtpfws/mtpfw/datatypes/bwins/mtpdatatypesU.DEF Wed Mar 31 22:58:56 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 Mon Mar 15 12:43:12 2010 +0200
+++ b/mtpfws/mtpfw/datatypes/bwins/mtpdatatypes_f32U.DEF Wed Mar 31 22:58:56 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 Mon Mar 15 12:43:12 2010 +0200
+++ b/mtpfws/mtpfw/datatypes/eabi/mtpdatatypesU.DEF Wed Mar 31 22:58:56 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 Mon Mar 15 12:43:12 2010 +0200
+++ b/mtpfws/mtpfw/datatypes/group/mtpdatatypes.mmp Wed Mar 31 22:58:56 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 Mon Mar 15 12:43:12 2010 +0200
+++ b/mtpfws/mtpfw/datatypes/interface/mtpdatatypeconstants.h Wed Mar 31 22:58:56 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 Mon Mar 15 12:43:12 2010 +0200
+++ b/mtpfws/mtpfw/datatypes/interface/tmtptypeguid.h Wed Mar 31 22:58:56 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 Mon Mar 15 12:43:12 2010 +0200
+++ b/mtpfws/mtpfw/datatypes/interface/tmtptyperesponse.h Wed Mar 31 22:58:56 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 Mon Mar 15 12:43:12 2010 +0200
+++ b/mtpfws/mtpfw/datatypes/src/cmtptypefile.cpp Wed Mar 31 22:58:56 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,8 +38,6 @@
const TUint KUSBHeaderLen = 12;
-
-
CMTPTypeFile::CFileWriter* CMTPTypeFile::CFileWriter::NewL(RFile& aFile, RBuf8& aWriteBuf)
{
CFileWriter *self = new(ELeave)CFileWriter(aFile, aWriteBuf);
@@ -87,6 +91,7 @@
{
iFile.SetSize(0);
}
+
}
@@ -178,6 +183,55 @@
*/
EXPORT_C void CMTPTypeFile::SetSizeL(TUint64 aSize)
{
+ //Firstly, check the disk free space, at anytime, we must make sure
+ //the free space can not be lower than the threshold value after this
+ //file syncing
+ TInt driveNo;
+ TDriveInfo driveInfo;
+ iFile.Drive(driveNo,driveInfo);
+ RFs fs;
+ TVolumeInfo volumeInfo;
+ fs.Connect();
+ fs.Volume(volumeInfo,driveNo);
+ fs.Close();
+
+ //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);
+ }
+
iTargetFileSize = (TInt64)aSize; //keep a record for the target file size
iRemainingDataSize = (TInt64)aSize;//Current implemenation does not support file size with 2 x64
@@ -205,6 +259,7 @@
}
iFileWriter1 = CFileWriter::NewL(iFile, iBuffer1);
iFileWriter2 = CFileWriter::NewL(iFile, iBuffer2);
+
}
/**
@@ -581,13 +636,14 @@
#endif
User::LeaveIfError(iFile.Size(size));
- if(aRequiredSize < size)
+
+ if(aOffSet + aRequiredSize <= size)
{
iTargetFileSize = aRequiredSize;
}
else
{
- iTargetFileSize = size;
+ iTargetFileSize = size - aOffSet;
}
iRemainingDataSize = iTargetFileSize;
--- a/mtpfws/mtpfw/datatypes/src/tmtptypeguid.cpp Mon Mar 15 12:43:12 2010 +0200
+++ b/mtpfws/mtpfw/datatypes/src/tmtptypeguid.cpp Wed Mar 31 22:58:56 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 Mon Mar 15 12:43:12 2010 +0200
+++ b/mtpfws/mtpfw/datatypes/src/tmtptyperesponse.cpp Wed Mar 31 22:58:56 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 Mon Mar 15 12:43:12 2010 +0200
+++ b/mtpfws/mtpfw/eabi/mtpframeworkU.DEF Wed Mar 31 22:58:56 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 Mon Mar 15 12:43:12 2010 +0200
+++ b/mtpfws/mtpfw/inc/cmtpdataprovider.h Wed Mar 31 22:58:56 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 Mon Mar 15 12:43:12 2010 +0200
+++ b/mtpfws/mtpfw/inc/cmtpdataprovidercontroller.h Wed Mar 31 22:58:56 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 Mon Mar 15 12:43:12 2010 +0200
+++ b/mtpfws/mtpfw/inc/cmtpobjectstore.h Wed Mar 31 22:58:56 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 Mon Mar 15 12:43:12 2010 +0200
+++ b/mtpfws/mtpfw/inc/mtpframeworkconst.h Wed Mar 31 22:58:56 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 Mon Mar 15 12:43:12 2010 +0200
+++ b/mtpfws/mtpfw/src/cmtpconnection.cpp Wed Mar 31 22:58:56 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 Mon Mar 15 12:43:12 2010 +0200
+++ b/mtpfws/mtpfw/src/cmtpdataprovider.cpp Wed Mar 31 22:58:56 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;
@@ -795,7 +817,9 @@
case KMTPDataTypeInvalid:
code = EMTPRespCodeInvalidDataset;
break;
-
+ case KErrDiskFull:
+ code = EMTPRespCodeStoreFull;
+ break;
default:
code = EMTPRespCodeGeneralError;
break;
--- a/mtpfws/mtpfw/src/cmtpdataproviderconfig.cpp Mon Mar 15 12:43:12 2010 +0200
+++ b/mtpfws/mtpfw/src/cmtpdataproviderconfig.cpp Wed Mar 31 22:58:56 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 Mon Mar 15 12:43:12 2010 +0200
+++ b/mtpfws/mtpfw/src/cmtpdataprovidercontroller.cpp Wed Mar 31 22:58:56 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 Mon Mar 15 12:43:12 2010 +0200
+++ b/mtpfws/mtpfw/src/cmtpobjectstore.cpp Wed Mar 31 22:58:56 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,13 @@
}
else
{
+ aObject.SetUint(CMTPObjectMetaData::EHandle, handle);
//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 +513,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 +594,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 +755,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 +894,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();
}
@@ -861,7 +922,7 @@
else
{
err = OpenDb(fullName);
- if (iDatabase.IsDamaged())
+ if (err==KErrNone && iDatabase.IsDamaged())
{
err = iDatabase.Recover();
}
@@ -981,14 +1042,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 +1071,7 @@
{
iBatched.GetL();
}
+ __FLOG_VA((_L8("LocateByHandleL - Exit result 0x%x"), result));
return result;
}
@@ -1171,107 +1236,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 Mon Mar 15 12:43:12 2010 +0200
+++ b/mtpfws/mtpfw/src/cmtpparserrouter.cpp Wed Mar 31 22:58:56 2010 +0300
@@ -1998,6 +1998,10 @@
// Object does not exist.
aParams.SetParam(TRoutingParameters::EFlagInvalid, ETrue);
}
+ else if(!iSingletons.StorageMgr().ValidStorageId(obj->Uint(CMTPObjectMetaData::EStorageId)))
+ {
+ aParams.SetParam(TRoutingParameters::EFlagInvalid, ETrue);
+ }
else
{
aParams.SetParam(CMTPParserRouter::TRoutingParameters::EParamFormatCode, obj->Uint(CMTPObjectMetaData::EFormatCode));
--- a/mtpfws/mtpintegrationtest/integration/mtpmodeselector/inc/CMAppGroupView.H Mon Mar 15 12:43:12 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,48 +0,0 @@
-// Copyright (c) 1997-2009 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:
-//
-
-/**
- @file
- @internalComponent
- @test
-*/
-#if !defined(__CMAPPGroupVIEW_H__)
-#define __CMAPPGroupVIEW_H__
-
-#include "CMLSTVW.H"
-
-
-class CContactsManAppGroupView : public CContactsManListView
- {
-public:
- static CContactsManAppGroupView* NewL(CCoeControl& aContainer,CContactsAppModel& aModel);
- TInt CurrentItemIndex();
- TInt NumberOfItems();
-private:
- CContactsManAppGroupView(CContactsAppModel& aModel,TContactsListViewPrefs* aPreferences);
- void NewGroupL();
-// from CContactsManViewBase
- virtual void HandleModelChangeL(TBool aCountChanged);
- virtual TBool HandleCommandL(TInt aCommand);
- virtual TUid ViewUid() const;
-//from MCoeView
- virtual void ViewActivatedL(const TVwsViewId& aPrevViewId, TUid aCustomMessageId, const TDesC8& aCustomMessage);
- virtual void ViewDeactivated();
-// from CCoeControl
- virtual TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType);
- void ConstructL(CCoeControl& aContainer);
- };
-
-#endif // __CMAPPGroupVIEW_H__
--- a/mtpfws/mtpintegrationtest/integration/mtpmodeselector/inc/CtransportInitiator.h Mon Mar 15 12:43:12 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,53 +0,0 @@
-// This material, including documentation and any related computer
-// programs, is protected by copyright controlled by Nokia. All
-// rights are reserved. Copying, including reproducing, storing
-// adapting or translating, any or all of this material requires the
-// prior written consent of Nokia. This material also contains
-// confidential information which may not be disclosed to others
-// without the prior written consent of Nokia.
-
-
-
-/**
- @file CtransportInitiator.h
-*/
- #ifndef __CTRANSPORTINITIATOR_H__
- #define __CTRANSPORTINITIATOR_H__
- #include <e32base.h>
- #include <f32file.h>
- #include <bautils.h>
- #include <mtp/mtpdataproviderapitypes.h>
-
-
- _LIT(KCMTPTest, "c:\\mtptest\\");
-_LIT(KZMTPTest, "z:\\mtptest\\");
-/**
- class CtransportInitiator
- Descibes creation of subset drives
- Running and stopping the transport as wished by the user
-*/
- class CtransportInitiator: public CBase
- {
- public :
- static CtransportInitiator* NewL();
- ~CtransportInitiator();
-
- private:
- void ConstructL();
- CtransportInitiator();
-
- public :
- void SetModeL(TMTPOperationalMode aMode);
- void RunMtpL();
- TInt DeleteMTPTestStorages();
- TInt CreateMTPTestStoragesL();
- };
-
-#endif
-
-
-
-
-
-
-
--- a/mtpfws/mtpintegrationtest/integration/mtpmodeselector/inc/MtpModeSelector.h Mon Mar 15 12:43:12 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,122 +0,0 @@
-// This material, including documentation and any related computer
-// programs, is protected by copyright controlled by Nokia. All
-// rights are reserved. Copying, including reproducing, storing
-// adapting or translating, any or all of this material requires the
-// prior written consent of Nokia. This material also contains
-// confidential information which may not be disclosed to others
-// without the prior written consent of Nokia.
-
-
-
-/**
- @file
- @internalComponent
- @test
-*/
-#ifndef __MTPMODESELECTOR_H__
-#define __MTPMODESELECTOR_H__
-
-#include <eikdialg.h>
-#include <eikchlst.h>
-#include "CtransportInitiator.h"
-
-
-class CMtpModeSelectorDlg : public CEikDialog
- {
-public:
- static CMtpModeSelectorDlg* NewL();
- CMtpModeSelectorDlg();
-
-private:
- void ConstructL();
- ~CMtpModeSelectorDlg();
- // from CEikDialog
- TBool OkToExitL(TInt aButtonId);
- void PreLayoutDynInitL();
-public :
- CtransportInitiator* iTransportInitiator;
-
- };
-
-
-
-/**
- * CModeSelectorAppView for creating a window and to draw the text
- *
- */
-class CModeSelectorAppView : public CCoeControl
- {
-public:
- // creates a CModeSelectorAppView object
- static CModeSelectorAppView* NewL(const TRect& aRect);
- ~CModeSelectorAppView();
-private:
- CModeSelectorAppView();
- void ConstructL(const TRect& aRect);
- //Draws the text on the screen
- void Draw(const TRect& /*aRect*/) const;
-
-private:
- //contains the text needs to be drawn
- HBufC* iExampleText;
- };
-
-
-/**
- * CModeSelectorAppUi handles the system events and menu events
- *
- */
-class CModeSelectorAppUi : public CEikAppUi
- {
-public:
- void ConstructL();
- ~CModeSelectorAppUi();
-
-private:
- // Inherirted from class CEikAppUi for handling menu events
- void HandleCommandL(TInt aCommand);
-
- // From CCoeAppUi to handle system events
- void HandleSystemEventL(const TWsEvent& aEvent);
-
-private:
- CCoeControl* iAppView;
- };
-
-
-/**
- * CExampleDocument for creating the application UI
- *
- */
-class CModeSelectorDocument : public CEikDocument
- {
-public:
- // creates a CExampleDocument object
- static CModeSelectorDocument* NewL(CEikApplication& aApp);
- CModeSelectorDocument(CEikApplication& aApp);
- void ConstructL();
-private:
- // Inherited from CEikDocument for creating the AppUI
- CEikAppUi* CreateAppUiL();
- };
-
-
-
-/**
- * CExampleApplication creates a new instance of the document
- * associated with this application
- *
- */
-class CModeSelectorApplication : public CEikApplication
- {
-private:
- // Inherited from class CApaApplication to create a new instance of the document
- CApaDocument* CreateDocumentL();
- //gets teh Application's UID
- TUid AppDllUid() const;
- };
-
-#endif
-
-
-
--- a/mtpfws/mtpintegrationtest/integration/mtpmodeselector/inc/mtpstarter.h Mon Mar 15 12:43:12 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,18 +0,0 @@
-// This material, including documentation and any related computer
-// programs, is protected by copyright controlled by Nokia. All
-// rights are reserved. Copying, including reproducing, storing
-// adapting or translating, any or all of this material requires the
-// prior written consent of Nokia. This material also contains
-// confidential information which may not be disclosed to others
-// without the prior written consent of Nokia.
-
-
-
-#ifndef __MTPSTARTER_H__
-#define __MTPSTARTER_H__
-
-
-TInt StartMTP();
-TInt StopMTP();
-
-#endif // MTPSTARTER_H
--- a/mtptransports/mtpusbtransport/usbdatatypes/src/tmtpusbparameterpayloadblock.cpp Mon Mar 15 12:43:12 2010 +0200
+++ b/mtptransports/mtpusbtransport/usbdatatypes/src/tmtpusbparameterpayloadblock.cpp Wed Mar 31 22:58:56 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 Mon Mar 15 12:43:12 2010 +0200
+++ b/mtptransports/mtpusbtransport/usbsic_imp/src/cmtpusbconnection.cpp Wed Mar 31 22:58:56 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));
@@ -1569,6 +1561,12 @@
TRAPD(err, BoundProtocolLayer().SendDataCompleteL(KErrAbort, *iUsbBulkContainer->Payload(), iMTPRequest));
UNUSED_VAR(err);
}
+ else if ((iBulkTransactionState == EResponsePhase) && iUsbBulkContainer->Payload())
+ {
+ __FLOG(_L8("Aborting active response phase"));
+ TRAPD(err, BoundProtocolLayer().SendResponseCompleteL(KErrAbort, *static_cast<TMTPTypeResponse*>(iUsbBulkContainer->Payload()), iMTPRequest));
+ UNUSED_VAR(err);
+ }
}
#ifdef __FLOG_ACTIVE
else