# HG changeset patch # User Dremov Kirill (Nokia-D-MSW/Tampere) # Date 1273844521 -10800 # Node ID a5c0bb5018eb385b0d38bf3195185987e5d1d5a7 # Parent 6e82ae192c3a162f2b2f321c4448817be544f711 Revision: 201019 Kit: 201019 diff -r 6e82ae192c3a -r a5c0bb5018eb backupandrestore/backuptest/burtestserver/Group/burtestserver.iby --- a/backupandrestore/backuptest/burtestserver/Group/burtestserver.iby Mon May 03 13:19:02 2010 +0300 +++ b/backupandrestore/backuptest/burtestserver/Group/burtestserver.iby Fri May 14 16:42:01 2010 +0300 @@ -18,7 +18,6 @@ file=ABI_DIR\BUILD_DIR\burtestserver.exe Sys\bin\burtestserver.exe data=EPOCROOT##Epoc32\data\z\testdata\scripts\sbetestdata\test.ini testdata\scripts\sbetestdata\test.ini -data=EPOCROOT##Epoc32\data\z\testdata\scripts\sbetestdata\sbeconfig.xml private\10202d56\sbeconfig.xml data=EPOCROOT##Epoc32\data\z\testdata\scripts\sbetestdata\backup_registration.xml testdata\scripts\sbetestdata\backup_registration.xml data=EPOCROOT##Epoc32\data\z\testdata\scripts\sbetestdata\increamenttest.xml testdata\scripts\sbetestdata\increamenttest.xml data=EPOCROOT##Epoc32\data\z\testdata\scripts\sbetestdata\test_registration.xml testdata\scripts\sbetestdata\test_registration.xml @@ -36,4 +35,8 @@ data=EPOCROOT##Epoc32\data\z\testdata\scripts\sbetestdata\test_activebackuprestore.script testdata\scripts\sbetestdata\test_activebackuprestore.script data=EPOCROOT##Epoc32\data\z\testdata\scripts\sbetestdata\test_increament.script testdata\scripts\sbetestdata\test_increament.script +#ifndef __SERIES60_ +data=EPOCROOT##Epoc32\data\z\testdata\scripts\sbetestdata\sbeconfig.xml private\10202d56\sbeconfig.xml +#endif + #endif // __BUR_TEST_SERVER_IBY__ diff -r 6e82ae192c3a -r a5c0bb5018eb backupandrestore/backuptest/burtestserver/TestSteps/src/t_teststepbackup2.cpp --- a/backupandrestore/backuptest/burtestserver/TestSteps/src/t_teststepbackup2.cpp Mon May 03 13:19:02 2010 +0300 +++ b/backupandrestore/backuptest/burtestserver/TestSteps/src/t_teststepbackup2.cpp Fri May 14 16:42:01 2010 +0300 @@ -21,6 +21,7 @@ #include #include "t_teststepbackup2.h" #include +#include namespace bur_ts { @@ -738,7 +739,7 @@ { //Coverage test get large public file list RPointerArray transferTypes; - CleanupClosePushL(transferTypes); + CleanupResetAndDestroyPushL(transferTypes); TRAP_IGNORE(GeneratePublicTransferTypesL(transferTypes)); RFileArray array; CleanupClosePushL(array); diff -r 6e82ae192c3a -r a5c0bb5018eb group/bld.inf --- a/group/bld.inf Mon May 03 13:19:02 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,20 +0,0 @@ -/* -* Copyright (c) 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: Build information file -* -*/ - - - -#include "../remoteconn_plat/group/bld.inf" diff -r 6e82ae192c3a -r a5c0bb5018eb layers.sysdef.xml --- a/layers.sysdef.xml Mon May 03 13:19:02 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,14 +0,0 @@ - - -]> - - - - - - - - - - diff -r 6e82ae192c3a -r a5c0bb5018eb mtpdataproviders/mtpfileandfolderdp/group/mtp_filedp.iby --- a/mtpdataproviders/mtpfileandfolderdp/group/mtp_filedp.iby Mon May 03 13:19:02 2010 +0300 +++ b/mtpdataproviders/mtpfileandfolderdp/group/mtp_filedp.iby Fri May 14 16:42:01 2010 +0300 @@ -16,7 +16,7 @@ #ifndef MTP_FILEDP_IBY #define MTP_FILEDP_IBY -#if !defined(SYMBIAN_EXCLUDE_MTP) +#if defined(__MTP_PROTOCOL_SUPPORT) #include @@ -26,7 +26,7 @@ // MTP plugin registration resource file data=EPOCROOT##epoc32\data\Z\resource\mtp\102827B0.rsc resource\mtp\102827B0.rsc -#endif // SYMBIAN_EXCLUDE_MTP +#endif // __MTP_PROTOCOL_SUPPORT #endif // MTP_FILEDP_IBY diff -r 6e82ae192c3a -r a5c0bb5018eb mtpdataproviders/mtpimagedp/inc/cmtpimagedp.h --- a/mtpdataproviders/mtpimagedp/inc/cmtpimagedp.h Mon May 03 13:19:02 2010 +0300 +++ b/mtpdataproviders/mtpimagedp/inc/cmtpimagedp.h Fri May 14 16:42:01 2010 +0300 @@ -63,8 +63,6 @@ TMTPFormatCode FindFormat(const TDesC& aExtension); const TDesC& FindMimeType(const TDesC& aExtension); - TBool GetCacheParentHandle(const TDesC& aParentPath, TUint32& aParentHandle); - void SetCacheParentHandle(const TDesC& aParentPath, TUint32 aParentHandle); void AppendDeleteObjectsArrayL(const TDesC& aSuid); void HandleDeleteObjectsArray(); void IncreaseNewPictures(TInt aCount); @@ -95,14 +93,7 @@ void SessionOpenedL(const TMTPNotificationParamsSessionChange& aSession); void RenameObjectL(const TMTPNotificationParamsHandle& aParam); - TUint QueryImageObjectCountL(); - -private: - struct SMTPImageDpParentCache - { - TPath iPath; - TUint32 iHandle; - }; + TUint QueryImageObjectCountL(); private: /** @@ -130,9 +121,7 @@ /** * contain the mapping image's extension to mime type */ - RHashMap, TBuf > iMimeMappings; - - SMTPImageDpParentCache iParentCache; + RHashMap, TBuf > iMimeMappings; TInt iActiveProcessor; TBool iActiveProcessorRemoved; diff -r 6e82ae192c3a -r a5c0bb5018eb mtpdataproviders/mtpimagedp/inc/cmtpimagedpsendobjectinfo.h --- a/mtpdataproviders/mtpimagedp/inc/cmtpimagedpsendobjectinfo.h Mon May 03 13:19:02 2010 +0300 +++ b/mtpdataproviders/mtpimagedp/inc/cmtpimagedpsendobjectinfo.h Fri May 14 16:42:01 2010 +0300 @@ -150,6 +150,7 @@ void CreateFsObjectL(); TMTPResponseCode ErrorToMTPError(TInt err)const; + TBool IsTooLarge(TUint64 aObjectSize) const; private: // Owned /** diff -r 6e82ae192c3a -r a5c0bb5018eb mtpdataproviders/mtpimagedp/inc/mtpimagedputilits.h --- a/mtpdataproviders/mtpimagedp/inc/mtpimagedputilits.h Mon May 03 13:19:02 2010 +0300 +++ b/mtpdataproviders/mtpimagedp/inc/mtpimagedputilits.h Fri May 14 16:42:01 2010 +0300 @@ -53,16 +53,6 @@ * update object status to old */ static void UpdateObjectStatusToOldL(MMTPDataProviderFramework& aFramework, CMTPObjectMetaData& aMetadata); - - /** - * query thumbnail size from metadata of object - */ - static TInt GetThumbnailSize(const CMTPObjectMetaData& aMetadata); - - /** - * update object thumbnail size - */ - static void UpdateObjectThumbnailSizeL(MMTPDataProviderFramework& aFramework, CMTPObjectMetaData& aMetadata, TInt aThumbnailSize); }; #endif MTPIMAGEDPUTILITS_H diff -r 6e82ae192c3a -r a5c0bb5018eb mtpdataproviders/mtpimagedp/src/cmtpimagedp.cpp --- a/mtpdataproviders/mtpimagedp/src/cmtpimagedp.cpp Mon May 03 13:19:02 2010 +0300 +++ b/mtpdataproviders/mtpimagedp/src/cmtpimagedp.cpp Fri May 14 16:42:01 2010 +0300 @@ -398,29 +398,29 @@ case EFormatExtensionSets: { - _LIT(KFormatExtensionJpg, "0x3801:jpg::3");//3 means file dp will enumerate all image files instead of image dp. + _LIT(KFormatExtensionJpg, "0x3801:jpg:::3");//3 means file dp will enumerate all image files instead of image dp. aStrings.AppendL(KFormatExtensionJpg); - _LIT(KFormatExtensionJpe, "0x3801:jpe::3"); + _LIT(KFormatExtensionJpe, "0x3801:jpe:::3"); aStrings.AppendL(KFormatExtensionJpe); - _LIT(KFormatExtensionJpeg, "0x3801:jpeg::3"); + _LIT(KFormatExtensionJpeg, "0x3801:jpeg:::3"); aStrings.AppendL(KFormatExtensionJpeg); /* * bmp files */ - _LIT(KFormatExtensionBmp, "0x3804:bmp::3"); + _LIT(KFormatExtensionBmp, "0x3804:bmp:::3"); aStrings.AppendL(KFormatExtensionBmp); /* * gif files */ - _LIT(KFormatExtensionGif, "0x3807:gif::3"); + _LIT(KFormatExtensionGif, "0x3807:gif:::3"); aStrings.AppendL(KFormatExtensionGif); /* * png files */ - _LIT(KFormatExtensionPng, "0x380B:png::3"); + _LIT(KFormatExtensionPng, "0x380B:png:::3"); aStrings.AppendL(KFormatExtensionPng); /* @@ -723,29 +723,6 @@ return newPictures; } -TBool CMTPImageDataProvider::GetCacheParentHandle(const TDesC& aParentPath, TUint32& aParentHandle) - { - TBool ret = EFalse; - - if (iParentCache.iPath.Compare(aParentPath) == 0) - { - aParentHandle = iParentCache.iHandle; - ret = ETrue; - } - else - { - aParentHandle = KMTPHandleNone; - } - - return ret; - } - -void CMTPImageDataProvider::SetCacheParentHandle(const TDesC& aParentPath, TUint32 aParentHandle) - { - iParentCache.iPath.Copy(aParentPath); - iParentCache.iHandle = aParentHandle; - } - void CMTPImageDataProvider::AppendDeleteObjectsArrayL(const TDesC& aSuid) { iDeleteObjectsArray.AppendL(aSuid.AllocLC()); diff -r 6e82ae192c3a -r a5c0bb5018eb mtpdataproviders/mtpimagedp/src/cmtpimagedpobjectpropertymgr.cpp --- a/mtpdataproviders/mtpimagedp/src/cmtpimagedpobjectpropertymgr.cpp Mon May 03 13:19:02 2010 +0300 +++ b/mtpdataproviders/mtpimagedp/src/cmtpimagedpobjectpropertymgr.cpp Fri May 14 16:42:01 2010 +0300 @@ -437,55 +437,46 @@ aValue = iObjectInfo->Uint(CMTPObjectMetaData::EParentHandle); break; - case EMTPObjectPropCodeRepresentativeSampleSize: - aValue = MTPImageDpUtilits::GetThumbnailSize(*iObjectInfo); - if (aValue == 0) + case EMTPObjectPropCodeRepresentativeSampleSize: + { + __FLOG_VA((_L16("Query smaple size from MdS - URI:%S"), &iObjectInfo->DesC(CMTPObjectMetaData::ESuid))); + ClearThumnailCache(); + /** + * try to query thumbnail from TNM, and then store thumbnail to cache + */ + TEntry fileEntry; + TInt err = iFs.Entry(iObjectInfo->DesC(CMTPObjectMetaData::ESuid), fileEntry); + if (err == KErrNone) { - __FLOG_VA((_L16("Query smaple size from MdS - URI:%S"), &iObjectInfo->DesC(CMTPObjectMetaData::ESuid))); - ClearThumnailCache(); + if(fileEntry.FileSize() > KFileSizeMax || !alwaysCreate) + { + iDataProvider.ThumbnailManager().GetThumbMgr()->SetFlagsL(CThumbnailManager::EDoNotCreate); + } + else + { + iDataProvider.ThumbnailManager().GetThumbMgr()->SetFlagsL(CThumbnailManager::EDefaultFlags); + } + /** - * try to query thumbnail from TNM, and then store thumbnail to cache + * trap the leave to avoid return general error when PC get object property list */ - TEntry fileEntry; - TInt err = iFs.Entry(iObjectInfo->DesC(CMTPObjectMetaData::ESuid), fileEntry); + TRAP(err, iDataProvider.ThumbnailManager().GetThumbnailL(iObjectInfo->DesC(CMTPObjectMetaData::ESuid), iThumbnailCache.iThumbnailData, err)); if (err == KErrNone) { - if(fileEntry.FileSize() > KFileSizeMax || !alwaysCreate) - { - iDataProvider.ThumbnailManager().GetThumbMgr()->SetFlagsL(CThumbnailManager::EDoNotCreate); - } - else - { - iDataProvider.ThumbnailManager().GetThumbMgr()->SetFlagsL(CThumbnailManager::EDefaultFlags); - } - - /** - * trap the leave to avoid return general error when PC get object property list - */ - TRAP(err, iDataProvider.ThumbnailManager().GetThumbnailL(iObjectInfo->DesC(CMTPObjectMetaData::ESuid), iThumbnailCache.iThumbnailData, err)); - if (err == KErrNone) + iThumbnailCache.iObjectHandle = iObjectInfo->Uint(CMTPObjectMetaData::EHandle); + if (iThumbnailCache.iThumbnailData != NULL) { - iThumbnailCache.iObjectHandle = iObjectInfo->Uint(CMTPObjectMetaData::EHandle); - if (iThumbnailCache.iThumbnailData != NULL) - { - aValue = static_cast(iThumbnailCache.iThumbnailData->Size()); - } - - if (aValue > 0) - { - //update metadata column - MTPImageDpUtilits::UpdateObjectThumbnailSizeL(iFramework, *iObjectInfo, aValue); - } - else - { - //trigger initiator to re-query thumbnail again if the thumbnail size of response is zero - aValue = KThumbCompressedSize; - } - - __FLOG_VA((_L16("Cache miss:GetThumbnailSize - URI:%S, Size:%u"), &iObjectInfo->DesC(CMTPObjectMetaData::ESuid), aValue)); + aValue = static_cast(iThumbnailCache.iThumbnailData->Size()); + } + + if (aValue <= 0) + { + //trigger initiator to re-query thumbnail again if the thumbnail size of response is zero + aValue = KThumbCompressedSize; } } - } + } + } break; case EMTPObjectPropCodeRepresentativeSampleHeight: @@ -618,17 +609,10 @@ TRAP(err, iDataProvider.ThumbnailManager().GetThumbnailL(iObjectInfo->DesC(CMTPObjectMetaData::ESuid), iThumbnailCache.iThumbnailData, err)); if (err == KErrNone) { - TInt size = MTPImageDpUtilits::GetThumbnailSize(*iObjectInfo); iThumbnailCache.iObjectHandle = iObjectInfo->Uint(CMTPObjectMetaData::EHandle); if (iThumbnailCache.iThumbnailData != NULL) { aValue.SetByDesL(*iThumbnailCache.iThumbnailData); - if (size == 0) - { - //update metadata column - MTPImageDpUtilits::UpdateObjectThumbnailSizeL(iFramework, *iObjectInfo, iThumbnailCache.iThumbnailData->Size()); - __FLOG_VA((_L16("Cache miss:GetThumbnailSize - URI:%S, Size:%u"), &iObjectInfo->DesC(CMTPObjectMetaData::ESuid), size)); - } } } } diff -r 6e82ae192c3a -r a5c0bb5018eb mtpdataproviders/mtpimagedp/src/cmtpimagedpsendobjectinfo.cpp --- a/mtpdataproviders/mtpimagedp/src/cmtpimagedpsendobjectinfo.cpp Mon May 03 13:19:02 2010 +0300 +++ b/mtpdataproviders/mtpimagedp/src/cmtpimagedpsendobjectinfo.cpp Fri May 14 16:42:01 2010 +0300 @@ -20,9 +20,9 @@ #include #include +#include #include - #include #include #include @@ -322,7 +322,11 @@ { iStorageId = iFramework.StorageMgr().DefaultStorageId(); } - + + if(IsTooLarge(iObjectSize)) + { + *ret = EMTPRespCodeObjectTooLarge; + } } __FLOG(_L8("CMTPImageDpSendObjectInfo::CheckObjectPropListParamsL - Exit")); @@ -608,6 +612,11 @@ if (result) { iObjectSize = iObjectInfo->Uint32L(CMTPTypeObjectInfo::EObjectCompressedSize); + if(IsTooLarge(iObjectSize)) + { + SendResponseL(EMTPRespCodeObjectTooLarge); + result = EFalse; + } } if (result) @@ -1277,3 +1286,40 @@ return resp; } + +/** +Check if the object is too large +@return ETrue if yes, otherwise EFalse +*/ +TBool CMTPImageDpSendObjectInfo::IsTooLarge(TUint64 aObjectSize) const + { + __FLOG(_L8("IsTooLarge - Entry")); + TBool ret(aObjectSize > KMaxTInt64); + + if(!ret) + { + TBuf<255> fsname; + TUint32 storageId = iStorageId; + if (storageId == KMTPStorageDefault) + { + storageId = iFramework.StorageMgr().DefaultStorageId(); + } + TInt drive( iFramework.StorageMgr().DriveNumber(storageId) ); + if(drive != KErrNotFound) + { + iFramework.Fs().FileSystemSubType(drive, fsname); + + const TUint64 KMaxFatFileSize = 0xFFFFFFFF; //Maximal file size supported by all FAT filesystems (4GB-1) + _LIT(KFsFAT16, "FAT16"); + _LIT(KFsFAT32, "FAT32"); + + if((fsname.CompareF(KFsFAT16) == 0 || fsname.CompareF(KFsFAT32) == 0) && aObjectSize > KMaxFatFileSize) + { + ret = ETrue; + } + } + } + __FLOG_VA((_L8("Result = %d"), ret)); + __FLOG(_L8("IsTooLarge - Exit")); + return ret; + } diff -r 6e82ae192c3a -r a5c0bb5018eb mtpdataproviders/mtpimagedp/src/mtpimagedputilits.cpp --- a/mtpdataproviders/mtpimagedp/src/mtpimagedputilits.cpp Mon May 03 13:19:02 2010 +0300 +++ b/mtpdataproviders/mtpimagedp/src/mtpimagedputilits.cpp Fri May 14 16:42:01 2010 +0300 @@ -64,24 +64,17 @@ return aFramework.StorageMgr().FrameworkStorageId(static_cast(driveNumber)); } -TUint32 MTPImageDpUtilits::FindParentHandleL(MMTPDataProviderFramework& aFramework, CMTPImageDataProvider& aDataProvider, const TDesC& aFullPath) +TUint32 MTPImageDpUtilits::FindParentHandleL(MMTPDataProviderFramework& aFramework, CMTPImageDataProvider& /*aDataProvider*/, const TDesC& aFullPath) { TUint32 parentHandle = KMTPHandleNoParent; TParsePtrC parse(aFullPath); if(!parse.IsRoot()) - { - if (!aDataProvider.GetCacheParentHandle(parse.DriveAndPath(), parentHandle)) - { - parentHandle = aFramework.ObjectMgr().HandleL(parse.DriveAndPath()); - if (parentHandle != KMTPHandleNone) - { - aDataProvider.SetCacheParentHandle(parse.DriveAndPath(), parentHandle); - } - } + { + parentHandle = aFramework.ObjectMgr().HandleL(parse.DriveAndPath()); } - return parentHandle; + return parentHandle; } TBool MTPImageDpUtilits::IsNewPicture(const CMTPObjectMetaData& aMetadata) @@ -100,30 +93,3 @@ aMetadata.SetUint(CMTPObjectMetaData::EFormatSubCode, status); aFramework.ObjectMgr().ModifyObjectL(aMetadata); } - -TInt MTPImageDpUtilits::GetThumbnailSize(const CMTPObjectMetaData& aMetadata) - { - /** - * query thumbnail size from EFormatSubCode column - */ - return (aMetadata.Uint(CMTPObjectMetaData::EFormatSubCode) & IMAGE_OBJECT_THUMBNAIL_SIZE_BITMASK); - } - -void MTPImageDpUtilits::UpdateObjectThumbnailSizeL(MMTPDataProviderFramework& aFramework, CMTPObjectMetaData& aMetadata, TInt aThumbnailSize) - { - //check thumbnail size whether it is overflow - if (aThumbnailSize <= IMAGE_OBJECT_THUMBNAIL_SIZE_BITMASK) - { - TBool newPic = MTPImageDpUtilits::IsNewPicture(aMetadata); - if (newPic) - { - aMetadata.SetUint(CMTPObjectMetaData::EFormatSubCode, aThumbnailSize); - } - else - { - aThumbnailSize |= IMAGE_OBJECT_STATUS_BITMASK; - aMetadata.SetUint(CMTPObjectMetaData::EFormatSubCode, aThumbnailSize); - } - aFramework.ObjectMgr().ModifyObjectL(aMetadata); - } - } diff -r 6e82ae192c3a -r a5c0bb5018eb mtpfws/mtpfw/dataproviders/devdp/group/mtp_devicedp.iby --- a/mtpfws/mtpfw/dataproviders/devdp/group/mtp_devicedp.iby Mon May 03 13:19:02 2010 +0300 +++ b/mtpfws/mtpfw/dataproviders/devdp/group/mtp_devicedp.iby Fri May 14 16:42:01 2010 +0300 @@ -17,7 +17,7 @@ #ifndef MTP_DEVICEDP_IBY #define MTP_DEVICEDP_IBY -#if !defined(SYMBIAN_EXCLUDE_MTP) +#if defined(__MTP_PROTOCOL_SUPPORT) // MTP Device Data Provider @@ -30,6 +30,6 @@ -#endif //SYMBIAN_EXCLUDE_MTP +#endif //__MTP_PROTOCOL_SUPPORT #endif //MTP_DEVICEDP_IBY diff -r 6e82ae192c3a -r a5c0bb5018eb mtpfws/mtpfw/dataproviders/dputility/bwins/mtpdataproviderutilityu.def --- a/mtpfws/mtpfw/dataproviders/dputility/bwins/mtpdataproviderutilityu.def Mon May 03 13:19:02 2010 +0300 +++ b/mtpfws/mtpfw/dataproviders/dputility/bwins/mtpdataproviderutilityu.def Fri May 14 16:42:01 2010 +0300 @@ -115,7 +115,7 @@ ?FormatFromFilename@RMTPUtility@@QAE?AW4TMTPFormatCode@@ABVTDesC16@@@Z @ 114 NONAME ; enum TMTPFormatCode RMTPUtility::FormatFromFilename(class TDesC16 const &) ?TTime2MTPTimeStr@RMTPUtility@@QBEHABVTTime@@AAVTDes16@@@Z @ 115 NONAME ; int RMTPUtility::TTime2MTPTimeStr(class TTime const &, class TDes16 &) const ?MTPUtility@RMTPDpSingletons@@QBEAAVRMTPUtility@@XZ @ 116 NONAME ; class RMTPUtility & RMTPDpSingletons::MTPUtility(void) const - ?GetDpId@RMTPUtility@@QAEKABVTDesC16@@0@Z @ 117 NONAME ; unsigned long RMTPUtility::GetDpId(class TDesC16 const &, class TDesC16 const &) + ?GetDpId@RMTPUtility@@QAEKABVTDesC16@@0@Z @ 117 NONAME ABSENT ; unsigned long RMTPUtility::GetDpId(class TDesC16 const &, class TDesC16 const &) ?GetFormatByExtension@RMTPUtility@@QAE?AW4TMTPFormatCode@@ABVTDesC16@@@Z @ 118 NONAME ; enum TMTPFormatCode RMTPUtility::GetFormatByExtension(class TDesC16 const &) ?SessionId@CMTPRequestProcessor@@MAEKXZ @ 119 NONAME ; unsigned long CMTPRequestProcessor::SessionId(void) ?GetEnumerationFlag@RMTPUtility@@QAEIABVTDesC16@@@Z @ 120 NONAME ; unsigned int RMTPUtility::GetEnumerationFlag(class TDesC16 const &) @@ -213,4 +213,7 @@ ?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) + ?GetDpIdL@RMTPUtility@@QAEKABVTDesC16@@0@Z @ 215 NONAME ; unsigned long RMTPUtility::GetDpIdL(class TDesC16 const &, class TDesC16 const &) + ?GetSubFormatCodeL@RMTPUtility@@QAEGABVTDesC16@@0@Z @ 216 NONAME ; unsigned short RMTPUtility::GetSubFormatCodeL(class TDesC16 const &, class TDesC16 const &) + ?GetFormatCodeByMimeTypeL@RMTPUtility@@QAE?AW4TMTPFormatCode@@ABVTDesC16@@0@Z @ 217 NONAME ; enum TMTPFormatCode RMTPUtility::GetFormatCodeByMimeTypeL(class TDesC16 const &, class TDesC16 const &) diff -r 6e82ae192c3a -r a5c0bb5018eb mtpfws/mtpfw/dataproviders/dputility/eabi/mtpdataproviderutilityu.def --- a/mtpfws/mtpfw/dataproviders/dputility/eabi/mtpdataproviderutilityu.def Mon May 03 13:19:02 2010 +0300 +++ b/mtpfws/mtpfw/dataproviders/dputility/eabi/mtpdataproviderutilityu.def Fri May 14 16:42:01 2010 +0300 @@ -210,7 +210,7 @@ _ZN11RMTPUtility18FormatFromFilenameERK7TDesC16 @ 209 NONAME _ZN11RMTPUtility20GetFormatByExtensionERK7TDesC16 @ 210 NONAME _ZN11RMTPUtility22FormatExtensionMappingEv @ 211 NONAME - _ZN11RMTPUtility7GetDpIdERK7TDesC16S2_ @ 212 NONAME + _ZN11RMTPUtility7GetDpIdERK7TDesC16S2_ @ 212 NONAME ABSENT _ZNK11RMTPUtility16MTPTimeStr2TTimeERK7TDesC16R5TTime @ 213 NONAME _ZNK11RMTPUtility16TTime2MTPTimeStrERK5TTimeR6TDes16 @ 214 NONAME _ZNK16RMTPDpSingletons10MTPUtilityEv @ 215 NONAME @@ -415,4 +415,7 @@ _ZTI16CMTPFSEntryCache @ 414 NONAME _ZTV16CMTPFSEntryCache @ 415 NONAME _ZN20CMTPRequestProcessor22RegisterPendingRequestEj @ 416 NONAME + _ZN11RMTPUtility17GetSubFormatCodeLERK7TDesC16S2_ @ 417 NONAME + _ZN11RMTPUtility24GetFormatCodeByMimeTypeLERK7TDesC16S2_ @ 418 NONAME + _ZN11RMTPUtility8GetDpIdLERK7TDesC16S2_ @ 419 NONAME diff -r 6e82ae192c3a -r a5c0bb5018eb mtpfws/mtpfw/dataproviders/dputility/inc/cmtpextensionmapping.h --- a/mtpfws/mtpfw/dataproviders/dputility/inc/cmtpextensionmapping.h Mon May 03 13:19:02 2010 +0300 +++ b/mtpfws/mtpfw/dataproviders/dputility/inc/cmtpextensionmapping.h Fri May 14 16:42:01 2010 +0300 @@ -34,6 +34,7 @@ const TDesC& Extension() const; TMTPFormatCode FormatCode() const; + TUint16 SubFormatCode() const; const TDesC& MIMEType() const; TUint32 DpId() const; TUint EnumerationFlag() const; @@ -42,6 +43,7 @@ void SetMIMETypeL(const TDesC& aMIMEType); void SetDpId(const TUint32 aDpId); void SetFormatCode(const TMTPFormatCode aFormatCode); + void SetSubFormatCode(TUint16 aSubFormatCode); void SetEnumerationFlag(const TUint aNeedFileDp); static TInt Compare(const CMTPExtensionMapping& aFirst, const CMTPExtensionMapping& aSecond); @@ -57,6 +59,7 @@ HBufC* iMIMEType; TUint32 iDpId; TUint iNeedFileDp; + TUint16 iSubFormatCode; }; #endif // CMTPEXTENSIONMAPPING_H diff -r 6e82ae192c3a -r a5c0bb5018eb mtpfws/mtpfw/dataproviders/dputility/inc/cmtpfsenumerator.h --- a/mtpfws/mtpfw/dataproviders/dputility/inc/cmtpfsenumerator.h Mon May 03 13:19:02 2010 +0300 +++ b/mtpfws/mtpfw/dataproviders/dputility/inc/cmtpfsenumerator.h Fri May 14 16:42:01 2010 +0300 @@ -65,7 +65,7 @@ void ScanNextSubdirL(); void ProcessEntriesL(); void AddEntryL(const TDesC& aPath, TUint32 &aHandle, TMTPFormatCode format, TUint32 aDPId, const TEntry& aEntry, TUint32 aStorageId, TUint32 aParentHandle); - void AddFileEntryForOtherDpL(const TDesC& aPath, TUint32 &aHandle, TMTPFormatCode format, TUint32 aDPId, const TEntry& aEntry, TUint32 aStorageId, TUint32 aParentHandle); + void AddFileEntryForOtherDpL(const TDesC& aPath, TUint32 &aHandle, TMTPFormatCode format, TUint32 aDPId, const TEntry& aEntry, TUint32 aStorageId, TUint32 aParentHandle, TUint16 aSubFormatCode = 0); void NotifyObjectAddToDP(const TUint32 aHandle,const TUint DpId); diff -r 6e82ae192c3a -r a5c0bb5018eb mtpfws/mtpfw/dataproviders/dputility/inc/cmtpsendobjectinfo.h --- a/mtpfws/mtpfw/dataproviders/dputility/inc/cmtpsendobjectinfo.h Mon May 03 13:19:02 2010 +0300 +++ b/mtpfws/mtpfw/dataproviders/dputility/inc/cmtpsendobjectinfo.h Fri May 14 16:42:01 2010 +0300 @@ -128,6 +128,8 @@ TFileName iName; TBool iNoRollback; RMTPFramework iSingletons; + static const TInt KExtensionLength = 8; + RArray< TBuf > iExceptionList; }; #endif //CMTPSENDOBJECTINFO_H diff -r 6e82ae192c3a -r a5c0bb5018eb mtpfws/mtpfw/dataproviders/dputility/inc/rmtputility.h --- a/mtpfws/mtpfw/dataproviders/dputility/inc/rmtputility.h Mon May 03 13:19:02 2010 +0300 +++ b/mtpfws/mtpfw/dataproviders/dputility/inc/rmtputility.h Fri May 14 16:42:01 2010 +0300 @@ -49,9 +49,20 @@ IMPORT_C TMTPFormatCode FormatFromFilename( const TDesC& aFullFileName ); IMPORT_C void FormatExtensionMapping(); IMPORT_C TMTPFormatCode GetFormatByExtension(const TDesC& aExtension); - IMPORT_C TUint32 GetDpId(const TDesC& aExtension,const TDesC& aMIMEType); + IMPORT_C TUint32 GetDpIdL(const TDesC& aExtension,const TDesC& aMIMEType); + IMPORT_C TUint16 GetSubFormatCodeL(const TDesC& aExtension,const TDesC& aMIMEType); + IMPORT_C TMTPFormatCode GetFormatCodeByMimeTypeL(const TDesC& aExtension,const TDesC& aMIMEType); IMPORT_C TUint GetEnumerationFlag(const TDesC& aExtension); - +private: + enum TParseState + { + EFormatCode, + Extension, + EMimeType, + ESubFormatCode, + EnumerationFlag, + EParseStateEnd + }; private: void RenameAllChildrenL(TUint32 aStorageId, TUint32 aParentHandle, const TDesC& aNewFolderName, const TDesC& aOldFolderName); TBool GetYear(const TDesC& aTimeString, TInt& aYear) const; @@ -63,18 +74,24 @@ TBool GetTenthSecond(const TDesC& aTimeString, TInt& aTenthSecond) const; TBool GetTimeZone(const TDesC& aTimeString, TBool& aPositiveTimeZone, TInt& aTimeZoneInHour, TInt& aTimeZoneInMinute) const; HBufC* OdfMimeTypeL( const TDesC& aFullFileName ); - void AppendFormatExtensionMapping(const CDesCArray& aFormatExtensionMapping,TUint32 aDpId); + void AppendFormatExtensionMappingL(const CDesCArray& aFormatExtensionMapping,TUint32 aDpId); void GetAllDecendents(TUint32 aStorageId, TUint aParentHandle, RArray& aHandles) const; + void ParseFormatCode(const TDesC& aString, CMTPExtensionMapping& aMapping, TParseState& aState); + void ParseExtension(const TDesC& aString, CMTPExtensionMapping& aMapping, TParseState& aState); + void ParseMimeType(const TDesC& aString, CMTPExtensionMapping& aMapping, TParseState& aState); + void ParseSubFormatCode(const TDesC& aString, CMTPExtensionMapping& aMapping, TParseState& aState); + void ParseEnumerationFlag(const TDesC& aString, CMTPExtensionMapping& aMapping, TParseState& aState); + void Parse(const TDesC& aString, CMTPExtensionMapping& aMapping, TParseState& aState); private: /** FLOGGER debug trace member variable. */ __FLOG_DECLARATION_MEMBER_MUTABLE; - MMTPDataProviderFramework* iFramework; RMTPFramework iSingleton; RPointerArray iFormatMappings; + TUint iEnumFlag; //temp code will remove after the correct their format string }; diff -r 6e82ae192c3a -r a5c0bb5018eb mtpfws/mtpfw/dataproviders/dputility/src/cmtpextensionmapping.cpp --- a/mtpfws/mtpfw/dataproviders/dputility/src/cmtpextensionmapping.cpp Mon May 03 13:19:02 2010 +0300 +++ b/mtpfws/mtpfw/dataproviders/dputility/src/cmtpextensionmapping.cpp Fri May 14 16:42:01 2010 +0300 @@ -65,6 +65,11 @@ return iFormatCode; } +TUint16 CMTPExtensionMapping::SubFormatCode() const + { + return iSubFormatCode; + } + TUint32 CMTPExtensionMapping::DpId() const { return iDpId; @@ -79,7 +84,6 @@ { delete iExtension; iExtension = NULL; - iExtension = aExtension.AllocL(); } @@ -100,6 +104,10 @@ { iFormatCode = aFormatCode; } +void CMTPExtensionMapping::SetSubFormatCode(TUint16 aSubFormatCode) + { + iSubFormatCode = aSubFormatCode; + } void CMTPExtensionMapping::SetEnumerationFlag(const TUint aNeedFileDp) { diff -r 6e82ae192c3a -r a5c0bb5018eb mtpfws/mtpfw/dataproviders/dputility/src/cmtpfsenumerator.cpp --- a/mtpfws/mtpfw/dataproviders/dputility/src/cmtpfsenumerator.cpp Mon May 03 13:19:02 2010 +0300 +++ b/mtpfws/mtpfw/dataproviders/dputility/src/cmtpfsenumerator.cpp Fri May 14 16:42:01 2010 +0300 @@ -456,7 +456,7 @@ { const TEntry& entry = iEntries[i]; iCurrentPath.Append(entry.iName); - __FLOG_VA((_L8("Process path %S name %S"), &iCurrentPath, &entry.iName)); + __FLOG_VA((_L("Process path %S name %S"), &iCurrentPath, &entry.iName)); #ifdef __FLOG_ACTIVE TBuf8 tmp; tmp.Copy(iCurrentPath); @@ -531,7 +531,7 @@ if (KMTPHandleNone == iFramework.ObjectMgr().HandleL(iCurrentPath)) { format = iDpSingletons.MTPUtility().GetFormatByExtension(parse.Ext().Mid(1)); - TUint32 DpId = iDpSingletons.MTPUtility().GetDpId(parse.Ext().Mid(1), KNullDesC); + TUint32 DpId = iDpSingletons.MTPUtility().GetDpIdL(parse.Ext().Mid(1), KNullDesC); AddFileEntryForOtherDpL(iCurrentPath, handle, format, DpId, entry, iStorages[iScanPos], iParentHandle); } break; @@ -542,33 +542,23 @@ TUint32 DpId = iFramework.DataProviderId(); if (parse.Ext().CompareF(KTxtExtensionODF)==0) { - format = iDpSingletons.MTPUtility().FormatFromFilename(parse.Ext().Mid(1)); - if ( EMTPFormatCode3GPContainer==format || EMTPFormatCodeMP4Container==format ) + HBufC* mime = iDpSingletons.MTPUtility().ContainerMimeType(iCurrentPath); + CleanupStack::PushL(mime); + if ( mime != NULL ) { - 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); + __FLOG_VA((_L("mime %S"), mime)); + DpId = iDpSingletons.MTPUtility().GetDpIdL(parse.Ext().Mid(1),*mime); + __FLOG_VA((_L("DpId find %d"), DpId)); } - else - { - format = EMTPFormatCodeUndefined; - AddEntryL(iCurrentPath, handle, format, iDpID, entry, iStorages[iScanPos], iParentHandle); - } + format = iDpSingletons.MTPUtility().GetFormatCodeByMimeTypeL(parse.Ext().Mid(1),*mime); + AddFileEntryForOtherDpL(iCurrentPath, handle, format, DpId, entry, iStorages[iScanPos], + iParentHandle, iDpSingletons.MTPUtility().GetSubFormatCodeL(parse.Ext().Mid(1),*mime)); + CleanupStack::PopAndDestroy(mime); } else { format = iDpSingletons.MTPUtility().GetFormatByExtension(parse.Ext().Mid(1)); - TUint32 DpId = iDpSingletons.MTPUtility().GetDpId(parse.Ext().Mid(1), KNullDesC); + TUint32 DpId = iDpSingletons.MTPUtility().GetDpIdL(parse.Ext().Mid(1), KNullDesC); AddFileEntryForOtherDpL(iCurrentPath, handle, format, DpId, entry, iStorages[iScanPos], iParentHandle); } } @@ -637,7 +627,7 @@ __FLOG_VA(_L8("AddEntryL - exit")); } -void CMTPFSEnumerator::AddFileEntryForOtherDpL(const TDesC& aPath, TUint32 &aHandle, TMTPFormatCode format, TUint32 aDPId, const TEntry& /*aEntry*/, TUint32 aStorageId, TUint32 aParentHandle) +void CMTPFSEnumerator::AddFileEntryForOtherDpL(const TDesC& aPath, TUint32 &aHandle, TMTPFormatCode format, TUint32 aDPId, const TEntry& /*aEntry*/, TUint32 aStorageId, TUint32 aParentHandle, TUint16 aSubFormatCode/* = 0*/) { #ifdef __FLOG_ACTIVE TBuf8 tmp; @@ -646,7 +636,6 @@ __FLOG_VA((_L8("AddFileEntryForOtherDpL - entry: %S"), &tmp)); #endif // __FLOG_ACTIVE - TUint16 assoc = EMTPAssociationTypeUndefined; TParsePtrC pathParser(aPath); TPtrC name(pathParser.Name()); @@ -656,7 +645,7 @@ iObject->SetUint(CMTPObjectMetaData::EFormatCode, format); iObject->SetUint(CMTPObjectMetaData::EStorageId, aStorageId); iObject->SetDesCL(CMTPObjectMetaData::ESuid, aPath); - iObject->SetUint(CMTPObjectMetaData::EFormatSubCode, assoc); + iObject->SetUint(CMTPObjectMetaData::EFormatSubCode, aSubFormatCode); iObject->SetUint(CMTPObjectMetaData::EParentHandle, aParentHandle); iObject->SetUint(CMTPObjectMetaData::ENonConsumable, EMTPConsumable); iObject->SetDesCL(CMTPObjectMetaData::EName, name); diff -r 6e82ae192c3a -r a5c0bb5018eb mtpfws/mtpfw/dataproviders/dputility/src/cmtpsendobjectinfo.cpp --- a/mtpfws/mtpfw/dataproviders/dputility/src/cmtpsendobjectinfo.cpp Mon May 03 13:19:02 2010 +0300 +++ b/mtpfws/mtpfw/dataproviders/dputility/src/cmtpsendobjectinfo.cpp Fri May 14 16:42:01 2010 +0300 @@ -220,6 +220,10 @@ iDpSingletons.OpenL(iFramework); iNoRollback = EFalse; iSingletons.OpenL(); + _LIT(KM4A, ".m4a"); + _LIT(KODF, ".odf"); + iExceptionList.AppendL(KM4A()); + iExceptionList.AppendL(KODF()); __FLOG(_L8("ConstructL - Exit")); } @@ -707,38 +711,48 @@ //with folder creation. if(!iIsFolder) - { - SetPropertiesL(); - iFramework.ObjectMgr().CommitReservedObjectHandleL(*iReceivedObject); - - TParsePtrC file( iFullPath ); - _LIT( KTxtExtensionODF, ".odf" ); - if ( file.ExtPresent() && file.Ext().CompareF(KTxtExtensionODF)==0 ) - { - TUint32 DpId = iFramework.DataProviderId(); - DpId = iDpSingletons.MTPUtility().GetDpId(file.Ext().Mid(1),KNullDesC); - //The data provider which owns all mimetypes of a file extension is not found - if ( 255 == DpId ) - { - HBufC* mime = NULL; - mime = iDpSingletons.MTPUtility().ContainerMimeType(iFullPath); - if ( mime != NULL ) - { - DpId = iDpSingletons.MTPUtility().GetDpId(file.Ext().Mid(1),*mime); - delete mime; - mime = NULL; - } - } - if ( DpId!=iFramework.DataProviderId() && DpId!=255) - { - iReceivedObject->SetUint(CMTPObjectMetaData::EDataProviderId,DpId); - //iReceivedObject->SetUint(CMTPObjectMetaData::EFormatCode,format); - iFramework.ObjectMgr().ModifyObjectL(*iReceivedObject); - TUint32 handle = iReceivedObject->Uint(CMTPObjectMetaData::EHandle); - iSingletons.DpController().NotifyDataProvidersL(DpId,EMTPObjectAdded,(TAny*)&handle); - } - } - } + { + SetPropertiesL(); + iFramework.ObjectMgr().CommitReservedObjectHandleL(*iReceivedObject); + iFullPath.LowerCase(); + __FLOG_VA((_L8("File Name %S"), &iFullPath)); + TParsePtrC file( iFullPath ); + if ( file.ExtPresent() && iExceptionList.Find(file.Ext()) != KErrNotFound) + { + TUint32 DpId = iFramework.DataProviderId(); + HBufC* mime = iDpSingletons.MTPUtility().ContainerMimeType(iFullPath); + CleanupStack::PushL(mime); + if ( mime != NULL ) + { + DpId = iDpSingletons.MTPUtility().GetDpIdL(file.Ext().Mid(1),*mime); + } + else + { + DpId = iDpSingletons.MTPUtility().GetDpIdL(file.Ext().Mid(1), KNullDesC); + } + if ( DpId!=iFramework.DataProviderId()) + { + iReceivedObject->SetUint(CMTPObjectMetaData::EDataProviderId,DpId); + TUint32 format = EMTPFormatCodeUndefined; + TUint16 subFormat = 0; + if(mime != NULL) + { + format = iDpSingletons.MTPUtility().GetFormatCodeByMimeTypeL(file.Ext().Mid(1),*mime); + subFormat = iDpSingletons.MTPUtility().GetSubFormatCodeL(file.Ext().Mid(1),*mime); + } + else + { + format = iDpSingletons.MTPUtility().GetFormatByExtension(file.Ext().Mid(1)); + } + iReceivedObject->SetUint(CMTPObjectMetaData::EFormatCode,format); + iReceivedObject->SetUint(CMTPObjectMetaData::EFormatSubCode,subFormat); + iFramework.ObjectMgr().ModifyObjectL(*iReceivedObject); + TUint32 handle = iReceivedObject->Uint(CMTPObjectMetaData::EHandle); + iSingletons.DpController().NotifyDataProvidersL(DpId,EMTPObjectAdded,(TAny*)&handle); + } + CleanupStack::PopAndDestroy(mime); + } + } SendResponseL(EMTPRespCodeOK); } diff -r 6e82ae192c3a -r a5c0bb5018eb mtpfws/mtpfw/dataproviders/dputility/src/rmtputility.cpp --- a/mtpfws/mtpfw/dataproviders/dputility/src/rmtputility.cpp Mon May 03 13:19:02 2010 +0300 +++ b/mtpfws/mtpfw/dataproviders/dputility/src/rmtputility.cpp Fri May 14 16:42:01 2010 +0300 @@ -31,13 +31,14 @@ #include "cmtpdataprovidercontroller.h" #include "cmtpextensionmapping.h" #include "cmtpdataprovider.h" +#include "mtpframeworkconst.h" using namespace ContentAccess; // Class constants. const TInt KMTPDateStringLength = 15; const TInt KMTPDateStringTIndex = 8; const TInt KMimeTypeMaxLength = 76; -const TInt KMAXPackageIDStringLen = 32; +//const TInt KMAXPackageIDStringLen = 32; _LIT( KTxtBackSlash, "\\" ); @@ -373,8 +374,8 @@ if ( file.Ext().CompareF( KTxtExtensionODF ) == 0 ) { TRAP( err, mime = OdfMimeTypeL( aFullPath ) ); + __FLOG_VA((_L("ContainerMimeType err %d mime %S"), err, mime)); } - return mime; } @@ -386,8 +387,10 @@ { CDesCArraySeg* FormatExtensionMapping = new (ELeave) CDesCArraySeg(4); CleanupStack::PushL(FormatExtensionMapping); - TRAP_IGNORE(iSingleton.DpController().DataProviderByIndexL(count).Plugin().SupportedL(EFormatExtensionSets,*FormatExtensionMapping)); - AppendFormatExtensionMapping(*FormatExtensionMapping,iSingleton.DpController().DataProviderByIndexL(count).DataProviderId()); + TRAP_IGNORE( + iSingleton.DpController().DataProviderByIndexL(count).Plugin().SupportedL(EFormatExtensionSets,*FormatExtensionMapping); + AppendFormatExtensionMappingL(*FormatExtensionMapping,iSingleton.DpController().DataProviderByIndexL(count).DataProviderId()); + ); CleanupStack::PopAndDestroy(FormatExtensionMapping); } } @@ -406,7 +409,29 @@ return EMTPFormatCodeUndefined; } -EXPORT_C TUint32 RMTPUtility::GetDpId(const TDesC& aExtension,const TDesC& aMIMEType) +EXPORT_C TUint32 RMTPUtility::GetDpIdL(const TDesC& aExtension,const TDesC& aMIMEType) + { + CMTPExtensionMapping* extensionMapping = CMTPExtensionMapping::NewL(aExtension, EMTPFormatCodeUndefined,aMIMEType); + CleanupStack::PushL(extensionMapping); + TInt found = KErrNotFound; + if(aMIMEType == KNullDesC) + { + found = iFormatMappings.FindInOrder(extensionMapping, TLinearOrder(CMTPExtensionMapping::Compare)); + } + else + { + found = iFormatMappings.FindInOrder(extensionMapping, TLinearOrder(CMTPExtensionMapping::ComparewithMIME)); + } + if ( KErrNotFound != found) + { + CleanupStack::PopAndDestroy(extensionMapping); + return iFormatMappings[found]->DpId(); + } + CleanupStack::PopAndDestroy(extensionMapping); + return KMTPFileDPID; + } + +EXPORT_C TUint16 RMTPUtility::GetSubFormatCodeL(const TDesC& aExtension,const TDesC& aMIMEType) { CMTPExtensionMapping* extensionMapping = CMTPExtensionMapping::NewL(aExtension, EMTPFormatCodeUndefined,aMIMEType); CleanupStack::PushL(extensionMapping); @@ -414,12 +439,27 @@ if ( KErrNotFound != found) { CleanupStack::PopAndDestroy(extensionMapping); - return iFormatMappings[found]->DpId(); + return iFormatMappings[found]->SubFormatCode(); } CleanupStack::PopAndDestroy(extensionMapping); - return 255; + return 0; } +EXPORT_C TMTPFormatCode RMTPUtility::GetFormatCodeByMimeTypeL(const TDesC& aExtension,const TDesC& aMIMEType) + { + CMTPExtensionMapping* extensionMapping = CMTPExtensionMapping::NewL(aExtension, EMTPFormatCodeUndefined,aMIMEType); + CleanupStack::PushL(extensionMapping); + TInt found = iFormatMappings.FindInOrder(extensionMapping, TLinearOrder(CMTPExtensionMapping::ComparewithMIME)); + if ( KErrNotFound != found) + { + CleanupStack::PopAndDestroy(extensionMapping); + return iFormatMappings[found]->FormatCode(); + } + CleanupStack::PopAndDestroy(extensionMapping); + return EMTPFormatCodeUndefined; + } + + EXPORT_C TUint RMTPUtility::GetEnumerationFlag(const TDesC& aExtension) { CMTPExtensionMapping* extensionMapping = CMTPExtensionMapping::NewL(aExtension, EMTPFormatCodeUndefined); @@ -558,25 +598,14 @@ if ( file.Ext().CompareF( KTxtExtensionODF ) == 0 ) { - RFs tempFsSession; - User::LeaveIfError(tempFsSession.Connect()); - CleanupClosePushL(tempFsSession); - User::LeaveIfError(tempFsSession.ShareProtected()); - - RFile tempFile; - User::LeaveIfError(tempFile.Open(tempFsSession, aFullPath, EFileRead|EFileShareAny)); - CleanupClosePushL(tempFile); - - //CContent* content = CContent::NewL( aFullPath ); - CContent* content = CContent::NewL( tempFile ); + CContent* content = CContent::NewL( aFullPath ); CleanupStack::PushL( content ); // + content HBufC* buffer = HBufC::NewL( KMimeTypeMaxLength ); CleanupStack::PushL( buffer ); // + buffer TPtr data = buffer->Des(); - TInt err = content->GetStringAttribute( EMimeType, data ); - + TInt err = content->GetStringAttribute( ContentAccess::EMimeType, data ); if ( err == KErrNone ) { mimebuf = HBufC::New( buffer->Length() ); @@ -585,8 +614,8 @@ { User::LeaveIfError( KErrNotFound ); } + mimebuf->Des().Copy( *buffer ); - mimebuf->Des().Copy( *buffer ); } // leave if NULL @@ -597,8 +626,6 @@ CleanupStack::PopAndDestroy( buffer ); // - buffer CleanupStack::PopAndDestroy( content ); // - content - CleanupStack::PopAndDestroy(&tempFile); // close - CleanupStack::PopAndDestroy(&tempFsSession); // close } else { @@ -607,65 +634,126 @@ return mimebuf; } +void RMTPUtility::ParseFormatCode(const TDesC& aString, CMTPExtensionMapping& aMapping, TParseState& aState) + { + + TLex lex(aString.Mid(2)); //skip 0x + TUint formatCode = EMTPFormatCodeUndefined; + lex.Val(formatCode, EHex); + aMapping.SetFormatCode(static_cast(formatCode)); + aState = Extension; + __FLOG_VA((_L("ParseFormatCode %S, 0x%x"), &aString, formatCode)); + } +void RMTPUtility::ParseExtension(const TDesC& aString, CMTPExtensionMapping& aMapping, TParseState& aState) + { + aMapping.SetExtensionL(aString); + aState = EMimeType; + __FLOG_VA((_L("ParseExtension %S"), &aString)); + } +void RMTPUtility::ParseMimeType(const TDesC& aString, CMTPExtensionMapping& aMapping, TParseState& aState) + { + aMapping.SetMIMETypeL(aString); + aState = ESubFormatCode; + __FLOG_VA((_L("ParseMimeType %S"), &aString)); + } +void RMTPUtility::ParseSubFormatCode(const TDesC& aString, CMTPExtensionMapping& aMapping, TParseState& aState) + { + iEnumFlag = 1; + TUint32 subFormatCode = 0; + if(aString != KNullDesC) + { + if(aString.Length() > 2) //temp code will remove after the correct their format string + { + TLex lex(aString.Mid(2)); //skip 0x + lex.Val(subFormatCode, EHex); + } + else//temp code will remove after the correct their format string + { + TLex lex(aString); + lex.Val(iEnumFlag, EDecimal); + } + } + aMapping.SetSubFormatCode(subFormatCode); + aState = EnumerationFlag; + __FLOG_VA((_L("ParseSubFormatCode %S, 0x%x"), &aString, subFormatCode)); + } +void RMTPUtility::ParseEnumerationFlag(const TDesC& aString, CMTPExtensionMapping& aMapping, TParseState& aState) + { + TUint enumFlag = iEnumFlag; //default is delegate to file DP + //temp code(iEnumFlag is temp the value should be 1) will remove after the correct their format string + if(aString != KNullDesC) + { + TLex lex(aString); + lex.Val(enumFlag, EDecimal); + } + aMapping.SetEnumerationFlag(enumFlag); + + __FLOG_VA((_L8("ParseEnumerationFlag %S, %d"), &aString, enumFlag)); + aState = EParseStateEnd; + } +void RMTPUtility::Parse(const TDesC& aString, CMTPExtensionMapping& aMapping, TParseState& aState) + { + switch(aState) + { + case EFormatCode: + ParseFormatCode(aString, aMapping, aState); + break; + case Extension: + ParseExtension(aString, aMapping, aState); + break; + case EMimeType: + ParseMimeType(aString, aMapping, aState); + break; + case ESubFormatCode: + ParseSubFormatCode(aString, aMapping, aState); + break; + case EnumerationFlag: + ParseEnumerationFlag(aString, aMapping, aState); + break; + default: + //do nothing; + break; + } + } -void RMTPUtility::AppendFormatExtensionMapping(const CDesCArray& aFormatExtensionMapping,TUint32 aDpId) +void RMTPUtility::AppendFormatExtensionMappingL(const CDesCArray& aFormatExtensionMapping,TUint32 aDpId) { //Parse the descriptor formatcode,fileextension, e.g. 0x3009:mp3 - TBuf stringSeg; - TInt splitter1(0); - TInt splitter2(0); - TInt found(0); - TUint formatCode = 0; - TUint isNeedFileDp = 1; - - for(TInt i=0; i < aFormatExtensionMapping.Count(); ++i) - { - CMTPExtensionMapping* extensionMapping = CMTPExtensionMapping::NewL(KNullDesC, EMTPFormatCodeUndefined); - CleanupStack::PushL(extensionMapping); - _LIT(KSPLITTER,":"); - splitter1 = aFormatExtensionMapping[i].FindF(KSPLITTER); - //Skip "0x", 2 is the length of "0x" - stringSeg = aFormatExtensionMapping[i].Mid(2, 4); - TLex lex(stringSeg); - User::LeaveIfError(lex.Val(formatCode, EHex)); - //Skip ":" - stringSeg = aFormatExtensionMapping[i].Mid(splitter1 + 1); - splitter2 = stringSeg.FindF(KSPLITTER); - if ( splitter2 == KErrNotFound ) - { - extensionMapping->SetExtensionL(stringSeg); - } - else - { - extensionMapping->SetExtensionL(aFormatExtensionMapping[i].Mid(splitter1+1,splitter2)); - stringSeg = stringSeg.Mid(splitter2+1); - splitter1 = stringSeg.FindF(KSPLITTER); - if ( splitter1==KErrNotFound ) - { - extensionMapping->SetMIMETypeL(stringSeg); - } - else if ( splitter1==0 ) - { - TLex lex1(stringSeg.Mid(splitter1+1)); - User::LeaveIfError(lex1.Val(isNeedFileDp, EDecimal)); - } - else - { - extensionMapping->SetMIMETypeL(stringSeg.Mid(0,splitter1)); - TLex lex2(stringSeg.Mid(splitter1+1)); - User::LeaveIfError(lex2.Val(isNeedFileDp, EDecimal)); - } - - } + //FromatCode:extension:MimeType:SubFormatCode:EnumerationFlag - found = iFormatMappings.FindInOrder(extensionMapping, TLinearOrder(CMTPExtensionMapping::ComparewithMIME)); - if (KErrNotFound == found) - { - extensionMapping->SetFormatCode((TMTPFormatCode)formatCode); - extensionMapping->SetDpId(aDpId); - extensionMapping->SetEnumerationFlag(isNeedFileDp); - iFormatMappings.InsertInOrderL(extensionMapping, TLinearOrder(CMTPExtensionMapping::ComparewithMIME)); - } - CleanupStack::Pop(extensionMapping); - } + TChar spliter(':'); + for(TInt i=0; i < aFormatExtensionMapping.Count(); ++i) + { + CMTPExtensionMapping* extensionMapping = CMTPExtensionMapping::NewL(KNullDesC, EMTPFormatCodeUndefined); + + TParseState state = EFormatCode; + TLex lex(aFormatExtensionMapping[i]); + lex.Mark(); + while(!lex.Eos()) + { + if(lex.Peek() == spliter) + { + Parse(lex.MarkedToken(), *extensionMapping, state); + lex.Inc(); //skip : + lex.Mark(); + } + else + { + lex.Inc(); //move to next char + } + } + while(state < EParseStateEnd) + { + Parse(lex.MarkedToken(), *extensionMapping, state); + lex.Mark(); + } + extensionMapping->SetDpId(aDpId); + if(iFormatMappings.InsertInOrder(extensionMapping, TLinearOrder(CMTPExtensionMapping::ComparewithMIME)) != KErrNone) + { + delete extensionMapping; + } + } } + + + diff -r 6e82ae192c3a -r a5c0bb5018eb mtpfws/mtpfw/datatypes/src/cmtptypefile.cpp --- a/mtpfws/mtpfw/datatypes/src/cmtptypefile.cpp Mon May 03 13:19:02 2010 +0300 +++ b/mtpfws/mtpfw/datatypes/src/cmtptypefile.cpp Fri May 14 16:42:01 2010 +0300 @@ -197,11 +197,20 @@ //Read the threshold value from Central Repository and check against it CRepository* repository(NULL); - TInt thresholdValue(0); + TInt64 thresholdValue(0); TRAPD(err,repository = CRepository::NewL(KCRUidUiklaf)); if (err == KErrNone) { - if (driveNo == EDriveC) + if (driveNo == EDriveE || driveNo == EDriveF) + { + TInt warningValue(0); + err = repository->Get(KUikOODDiskFreeSpaceWarningNoteLevelMassMemory,warningValue); + if (err == KErrNone) + { + thresholdValue = warningValue + KFreeSpaceExtraReserved; + } + } + else { TInt warningUsagePercent(0); err = repository->Get(KUikOODDiskFreeSpaceWarningNoteLevel,warningUsagePercent); @@ -211,14 +220,7 @@ + KFreeSpaceExtraReserved; } } - else - { - err = repository->Get(KUikOODDiskFreeSpaceWarningNoteLevelMassMemory,thresholdValue); - if (err == KErrNone) - { - thresholdValue += KFreeSpaceExtraReserved; - } - } + delete repository; } diff -r 6e82ae192c3a -r a5c0bb5018eb mtpfws/mtpfw/group/mtp_framework.iby --- a/mtpfws/mtpfw/group/mtp_framework.iby Mon May 03 13:19:02 2010 +0300 +++ b/mtpfws/mtpfw/group/mtp_framework.iby Fri May 14 16:42:01 2010 +0300 @@ -18,7 +18,7 @@ #include -#if !defined(SYMBIAN_EXCLUDE_MTP) +#if defined(__MTP_PROTOCOL_SUPPORT) // MTP Data Types Library @@ -64,6 +64,6 @@ //MTP device icon property file data=EPOCROOT##epoc32\data\Z\private\102827a2\mtpdevice.ico private\102827a2\mtpdevice.ico -#endif // SYMBIAN_EXCLUDE_MTP +#endif // __MTP_PROTOCOL_SUPPORT #endif // MTP_FRAMEWORK_IBY diff -r 6e82ae192c3a -r a5c0bb5018eb mtpfws/mtpfw/src/cmtpconnection.cpp --- a/mtpfws/mtpfw/src/cmtpconnection.cpp Mon May 03 13:19:02 2010 +0300 +++ b/mtpfws/mtpfw/src/cmtpconnection.cpp Fri May 14 16:42:01 2010 +0300 @@ -329,6 +329,8 @@ if (aMTPId != KMTPSessionNone) { // Notify the data providers if other than the null session is closing. + // OpenSession Command coming and now it is really connected to host. + PublishConnState(EConnectedToHost); TMTPNotificationParamsSessionChange params = {aMTPId, *this}; iSingletons.DpController().NotifyDataProvidersL(EMTPSessionOpened, ¶ms); } @@ -406,7 +408,7 @@ iTransportConnection = &aTransportConnection; iTransportConnection->BindL(*this); SetState(EStateOpen); - PublishConnState(EConnectedToHost); + } __FLOG(_L8("ConnectionResumed - Exit")); diff -r 6e82ae192c3a -r a5c0bb5018eb mtpfws/mtpfw/src/cmtpconnectionmgr.cpp --- a/mtpfws/mtpfw/src/cmtpconnectionmgr.cpp Mon May 03 13:19:02 2010 +0300 +++ b/mtpfws/mtpfw/src/cmtpconnectionmgr.cpp Fri May 14 16:42:01 2010 +0300 @@ -182,7 +182,7 @@ { iTransport->Stop(*this); delete iTransport; - + iTransportCount--; iTransport = CMTPTransportPlugin::NewL(aTransport, aParameter); TRAPD(err, iTransport->StartL(*this)); @@ -191,11 +191,12 @@ __FLOG_VA( ( _L8("StartTransportL error, error code = %d"), err) ); delete iTransport; iTransport = NULL; + User::Leave(err); } + iTransportCount++; iTransportUid = aTransport; - iTransportCount++; } } diff -r 6e82ae192c3a -r a5c0bb5018eb mtpfws/mtpfw/src/cmtpdeltadatamgr.cpp --- a/mtpfws/mtpfw/src/cmtpdeltadatamgr.cpp Mon May 03 13:19:02 2010 +0300 +++ b/mtpfws/mtpfw/src/cmtpdeltadatamgr.cpp Fri May 14 16:42:01 2010 +0300 @@ -291,7 +291,7 @@ TInt64 puidlow = 1; TBuf8 puidBuffer; - for(TInt count=0;count puidBuffer; - for(TInt count=0;count puidBuffer; - for(TInt count=0;count puidBuffer; - for(TInt count=0;count //MTP Controller LOCOD service plugin ECOM_PLUGIN(mtpcontroller.dll, mtpcontroller.rsc) -#endif// SYMBIAN_EXCLUDE_MTP +#endif// __MTP_PROTOCOL_SUPPORT #endif// MTP_CONTROLLER_IBY diff -r 6e82ae192c3a -r a5c0bb5018eb mtptransports/mtpcontroller/group/mtpcontroller.mmp --- a/mtptransports/mtpcontroller/group/mtpcontroller.mmp Mon May 03 13:19:02 2010 +0300 +++ b/mtptransports/mtpcontroller/group/mtpcontroller.mmp Fri May 14 16:42:01 2010 +0300 @@ -42,7 +42,7 @@ SOURCE cmtpcontrollerbase.cpp SOURCE cmtpbluetoothcontroller.cpp SOURCE cmtpoperator.cpp -SOURCE proxy.cpp +SOURCE proxy.cpp cmtpcontrollertimer.cpp LIBRARY euser.lib LIBRARY ecom.lib diff -r 6e82ae192c3a -r a5c0bb5018eb mtptransports/mtpcontroller/inc/cmtpcontrollertimer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mtptransports/mtpcontroller/inc/cmtpcontrollertimer.h Fri May 14 16:42:01 2010 +0300 @@ -0,0 +1,60 @@ +// Copyright (c) 2007-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 +*/ + +#ifndef CMTPCONTROLLERTIMER_H_ +#define CMTPCONTROLLERTIMER_H_ + +#include +#include +#include "mtpdebug.h" + +class CMTPOperator; + +class CMTPControllerTimer : public CTimer + { +private: + + enum { ETimerMultiplier = 1000000 }; + +public: + static CMTPControllerTimer* NewLC( RMTPClient& aMTPClient, CMTPOperator& aMTPOperator ); + static CMTPControllerTimer* NewL( RMTPClient& aMTPClient , CMTPOperator& aMTPOperator ); + void Start( TInt aTimeOut ); + TBool GetStopTransportStatus(); + ~CMTPControllerTimer(); + +private: + CMTPControllerTimer(RMTPClient& aMTPClient, CMTPOperator& aMTPOperator); + void ConstructL(); + void RunL(); + +private: + __FLOG_DECLARATION_MEMBER_MUTABLE; + + RMTPClient& iMTPClient; + CMTPOperator * iMTPOperator; + TBool iStopTransport; + + }; + + +#endif /* CMTPCONTROLLERTIMER_H_ */ diff -r 6e82ae192c3a -r a5c0bb5018eb mtptransports/mtpcontroller/inc/cmtpoperator.h --- a/mtptransports/mtpcontroller/inc/cmtpoperator.h Mon May 03 13:19:02 2010 +0300 +++ b/mtptransports/mtpcontroller/inc/cmtpoperator.h Fri May 14 16:42:01 2010 +0300 @@ -24,10 +24,14 @@ #define CMTPOPERATOR_H_ #include -#include +#include + #include "mmtpoperatornotifier.h" +#include "cmtpcontrollertimer.h" #include "mtpdebug.h" + + NONSHARABLE_CLASS( CMTPOperator ) : public CActive { private: @@ -52,6 +56,9 @@ void StartTransport( TUid aTransport ); void StopTransport( TUid aTransport ); + void StartTimer (TInt aSecond); + void SubscribeConnState(); + private:// From CActive void DoCancel(); void RunL(); @@ -62,6 +69,7 @@ TInt AppendOperation( TOperationType aType, TUid aTransport ); void Schedule( TInt aError ); void HandleOperationL( const TOperation& aOperation ); + private: /** * FLOGGER debug trace member variable. @@ -73,6 +81,19 @@ RArray< TOperation > iPendingOperations; RMTPClient iMTPClient; + + RProperty iProperty; + + TBool iConSubscribed; + + TInt iConnState; + + CMTPControllerTimer* iTimer; + }; + +const TInt KInitialValue = -1; +const TInt KStopMTPSeconds = 30; + #endif /* CMTPOPERATOR_H_ */ diff -r 6e82ae192c3a -r a5c0bb5018eb mtptransports/mtpcontroller/src/cmtpcontrollertimer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mtptransports/mtpcontroller/src/cmtpcontrollertimer.cpp Fri May 14 16:42:01 2010 +0300 @@ -0,0 +1,97 @@ +// Copyright (c) 2007-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 +*/ + +#include "cmtpcontrollertimer.h" +#include "cmtpoperator.h" + +__FLOG_STMT( _LIT8( KComponent, "mtpConTimer" ); ) + +const TUid KMTPBtTransportUid = { 0x10286FCB }; +const TInt KStartMTPSeconds = 7; + +CMTPControllerTimer* CMTPControllerTimer::NewLC( RMTPClient& aMTPClient, CMTPOperator & aMTPOperator ) + { + CMTPControllerTimer* self = new(ELeave) CMTPControllerTimer( aMTPClient, aMTPOperator ); + CleanupStack::PushL( self ); + self->ConstructL(); + return self; + } + +CMTPControllerTimer* CMTPControllerTimer::NewL( RMTPClient& aMTPClient, CMTPOperator & aMTPOperator ) + { + CMTPControllerTimer* self = NewLC( aMTPClient, aMTPOperator ); + CleanupStack::Pop( self ); + return self; + } + +void CMTPControllerTimer::Start( TInt aTimeOut ) + { + CTimer::After( aTimeOut * ETimerMultiplier ); + } + +TBool CMTPControllerTimer::GetStopTransportStatus() + { + return iStopTransport; + } + +CMTPControllerTimer::~CMTPControllerTimer() + { + __FLOG( _L8("CMPTControllerTimer destruction") ); + __FLOG_CLOSE; + } + +CMTPControllerTimer::CMTPControllerTimer( RMTPClient& aMTPClient, CMTPOperator& aMTPOperator ): + CTimer( CActive::EPriorityStandard ), iMTPClient(aMTPClient) + { + __FLOG_OPEN( KMTPSubsystem, KComponent ); + iMTPOperator = &aMTPOperator; + } + +void CMTPControllerTimer::ConstructL() + { + CTimer::ConstructL(); + CActiveScheduler::Add( this ); + iStopTransport = EFalse; + __FLOG( _L8("CMPTControllerTimer construction") ); + } + +void CMTPControllerTimer::RunL() + { + if (KErrNone == iMTPClient.IsProcessRunning() && !iStopTransport) + { + __FLOG( _L8("Stop transport to shut down mtp server") ); + TInt error = iMTPClient.StopTransport(KMTPBtTransportUid); + iMTPClient.Close(); + iStopTransport = ETrue; + __FLOG_1( _L8("The return value of stop transport is: %d"), error ); + iMTPOperator->StartTimer(KStartMTPSeconds); + } + else + { + __FLOG( _L8("Start transport to launch mtp server") ); + + iMTPClient.Connect(); + iMTPClient.StartTransport(KMTPBtTransportUid); + iStopTransport = EFalse; + iMTPOperator->SubscribeConnState(); + } + } diff -r 6e82ae192c3a -r a5c0bb5018eb mtptransports/mtpcontroller/src/cmtpoperator.cpp --- a/mtptransports/mtpcontroller/src/cmtpoperator.cpp Mon May 03 13:19:02 2010 +0300 +++ b/mtptransports/mtpcontroller/src/cmtpoperator.cpp Fri May 14 16:42:01 2010 +0300 @@ -24,6 +24,7 @@ __FLOG_STMT( _LIT8( KComponent, "mtpoperator" ); ) + CMTPOperator* CMTPOperator::NewL( MMTPOperatorNotifier& aNotifier ) { CMTPOperator* self = new( ELeave ) CMTPOperator( aNotifier ); @@ -37,6 +38,8 @@ iPendingOperations.Reset(); iPendingOperations.Close(); iMTPClient.Close(); + iProperty.Close(); + delete iTimer; __FLOG( _L8("+/-Dtor") ); __FLOG_CLOSE; } @@ -44,6 +47,7 @@ void CMTPOperator::StartTransport( TUid aTransport ) { __FLOG_1( _L8("+/-StartTransport( 0x%08X )"), aTransport.iUid ); + TInt err = AppendOperation( EStartTransport, aTransport ); if ( KErrNone != err ) { @@ -61,23 +65,82 @@ } } +void CMTPOperator::StartTimer(TInt aSecond) + { + __FLOG(_L8("StartTimer in cmtpoperator!")); + iTimer->Start(aSecond); + } + void CMTPOperator::DoCancel() { __FLOG( _L8("+/-DoCancel") ); + iProperty.Cancel(); + iConSubscribed = EFalse; } void CMTPOperator::RunL() { __FLOG( _L8("+RunL") ); + iConSubscribed = EFalse; TInt count = iPendingOperations.Count(); + + TInt connState = KInitialValue; + if ( count > 0 ) { TOperation& operation = iPendingOperations[0]; TRAP_IGNORE( HandleOperationL( operation ) ); iPendingOperations.Remove( 0 ); } - + else + { + //this will go on to get the updated connection status. + SubscribeConnState(); + + + TInt error = iProperty.Get(KMTPPublishConnStateCat, EMTPConnStateKey, connState); + __FLOG_2(_L8("Before, the iConnState is %d and connState is %d"), iConnState, connState); + if ( KErrNotFound == error ) + { + iConnState = KInitialValue; + __FLOG( _L8("The key is deleted and mtp server shut down!") ); + } + else + { + if (iTimer->IsActive() && !iTimer->GetStopTransportStatus()) + { + __FLOG( _L8("Timer is cancelled!") ); + iTimer->Cancel(); + } + //if the disconnect is not set, set the disconnect + //else if the connState is disconnect, launch the timer to restart the server to unload dps. + if ( KInitialValue == iConnState ) + { + iConnState = connState; + __FLOG( _L8("the first time to launch mtp") ); + } + else + { + if (EDisconnectedFromHost == connState) + { + iConnState = connState; + if (!iTimer->IsActive()) + { + iTimer->Start(KStopMTPSeconds); + } + __FLOG( _L8("Timer is launched.") ); + } + else + { + + iConnState = connState; + } + } + } + __FLOG_2(_L8("After, the iConnState is %d and connState is %d"), iConnState, connState); + } + __FLOG( _L8("-RunL") ); } @@ -93,7 +156,21 @@ { __FLOG( _L8("+ConstructL") ); CActiveScheduler::Add( this ); + //if the server is running, the first disconnction shows the conection is down! + if(KErrNone == iMTPClient.IsProcessRunning()) + { + iConnState = EDisconnectedFromHost; + } + else + { + iConnState = KInitialValue; + } + __FLOG_1( _L8("The connstate is set to %d"), iConnState ); User::LeaveIfError( iMTPClient.Connect() ); + User::LeaveIfError(iProperty.Attach(KMTPPublishConnStateCat, EMTPConnStateKey)); + iTimer = CMTPControllerTimer::NewL(iMTPClient, *this); + + iConSubscribed = EFalse; __FLOG( _L8("-ConstructL") ); } @@ -101,17 +178,33 @@ { TOperation operation = { aType, aTransport }; TInt err = iPendingOperations.Append( operation ); + __FLOG_1( _L8("+AppendOperation returns %d"), err ); if ( ( KErrNone == err ) && !IsActive() ) { Schedule( KErrNone ); } - __FLOG_1( _L8("+/-AppendOperation returns %d"), err ); + else + { + if (iConSubscribed) + { + Cancel(); + if (KErrNone == err) + { + Schedule( KErrNone ); + } + } + } + __FLOG( _L8("-AppendOperation") ); return err; } void CMTPOperator::Schedule( TInt aError ) { __FLOG_1( _L8("+/-Schedule( %d )"), aError ); + if(iTimer->IsActive()) + { + iTimer->Cancel(); + } TRequestStatus* status = &iStatus; User::RequestComplete( status, aError ); SetActive(); @@ -126,13 +219,31 @@ case EStartTransport: err = iMTPClient.StartTransport( aOperation.iTransport ); iNotifier.HandleStartTrasnportCompleteL( err ); + SubscribeConnState(); break; default: __ASSERT_DEBUG( ( EStopTransport == aOperation.iType ), User::Invariant() ); - err = iMTPClient.StopTransport( aOperation.iTransport ); + if(!iTimer->GetStopTransportStatus()) + { + err = iMTPClient.StopTransport( aOperation.iTransport ); + } + iNotifier.HandleStopTrasnportCompleteL( err ); break; } __FLOG( _L8("-HandleOperationL") ); } +void CMTPOperator::SubscribeConnState() + { + if(!IsActive()) + { + __FLOG( _L8("Subscribe connection state changed)") ); + iProperty.Subscribe(iStatus); + iConSubscribed = ETrue; + SetActive(); + } + + } + + diff -r 6e82ae192c3a -r a5c0bb5018eb mtptransports/mtpptpiptransport/group/mtp_ptpip.iby --- a/mtptransports/mtpptpiptransport/group/mtp_ptpip.iby Mon May 03 13:19:02 2010 +0300 +++ b/mtptransports/mtpptpiptransport/group/mtp_ptpip.iby Fri May 14 16:42:01 2010 +0300 @@ -16,7 +16,7 @@ #ifndef MTP_PTPIP_IBY #define MTP_PTPIP_IBY -#if !defined (SYMBIAN_EXCLUDE_MTP) && !defined(SYMBIAN_EXCLUDE_PTPTIP) +#if defined (__MTP_PROTOCOL_SUPPORT) && !defined(SYMBIAN_EXCLUDE_PTPTIP) #include @@ -30,7 +30,7 @@ ECOM_PLUGIN(ptpipplugin.dll, ptpipplugin.rsc) -#endif // SYMBIAN_EXCLUDE_MTP +#endif // __MTP_PROTOCOL_SUPPORT #endif // MTP_PTPIP_IBY diff -r 6e82ae192c3a -r a5c0bb5018eb mtptransports/mtpusbtransport/group/mtp_usbsic.iby --- a/mtptransports/mtpusbtransport/group/mtp_usbsic.iby Mon May 03 13:19:02 2010 +0300 +++ b/mtptransports/mtpusbtransport/group/mtp_usbsic.iby Fri May 14 16:42:01 2010 +0300 @@ -16,7 +16,7 @@ #ifndef MTP_USBSIC_IBY #define MTP_USBSIC_IBY -#if !defined (SYMBIAN_EXCLUDE_MTP) && !defined(SYMBIAN_EXCLUDE_USB) +#if defined (__MTP_PROTOCOL_SUPPORT) && defined(__USB) #include @@ -29,7 +29,7 @@ //MTP USB SIC transport plugin ECOM_PLUGIN(mtpusbsicimp.dll, mtpusbsicimp.rsc) -#endif // SYMBIAN_EXCLUDE_MTP +#endif // __MTP_PROTOCOL_SUPPORT && __USB #endif // MTP_USBSIC_IBY diff -r 6e82ae192c3a -r a5c0bb5018eb obex/obexprotocol/group/obexprotocol.iby --- a/obex/obexprotocol/group/obexprotocol.iby Mon May 03 13:19:02 2010 +0300 +++ b/obex/obexprotocol/group/obexprotocol.iby Fri May 14 16:42:01 2010 +0300 @@ -63,7 +63,7 @@ REM *** Now for things which should only be included if the device REM *** supports USB, to save ROM space... -#ifdef SYMBIAN_EXCLUDE_USB +#ifndef __USB REM OBEX USB transport is not included in this ROM as it depends on USB #else OBEX_PLUGIN(obexusbtransportcontroller.dll,1020de87.rsc) @@ -72,7 +72,7 @@ REM *** Now for things which should only be included if the device REM *** supports bluetooth, to save ROM space... -#ifdef SYMBIAN_EXCLUDE_BLUETOOTH +#ifndef __BT REM OBEX Bluetooth transport is not included in this ROM as it depends on BLUETOOTH #else OBEX_PLUGIN(obexbtrfcommtransportcontroller.dll,1020e043.rsc) diff -r 6e82ae192c3a -r a5c0bb5018eb remoteconn_plat/group/bld.inf --- a/remoteconn_plat/group/bld.inf Mon May 03 13:19:02 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,19 +0,0 @@ -/* -* Copyright (c) 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: Includes all the Domain API specific bld.inf files, which -* export files. -* -*/ - - diff -r 6e82ae192c3a -r a5c0bb5018eb sysdef_1_4_0.dtd --- a/sysdef_1_4_0.dtd Mon May 03 13:19:02 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,86 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -