# HG changeset patch # User Dremov Kirill (Nokia-D-MSW/Tampere) # Date 1282117131 -10800 # Node ID 48c22c726cf9396d77ff55a4c9b97d2b6b90ce68 # Parent 883e91c086aaadfd31ce6948a0986024c7b46841 Revision: 201031 Kit: 201033 diff -r 883e91c086aa -r 48c22c726cf9 backupandrestore/backupengine/src/absession.cpp --- a/backupandrestore/backupengine/src/absession.cpp Tue Jul 06 15:13:34 2010 +0300 +++ b/backupandrestore/backupengine/src/absession.cpp Wed Aug 18 10:38:51 2010 +0300 @@ -148,7 +148,12 @@ iCallbackWatchdog = NULL; // Remove this session from the server's session map - Server().RemoveElement(iClientSID); + // Use dynamic_cast in case that ABServer is deconstructing + CABServer *pServer = dynamic_cast(const_cast(CSession2::Server())); + if(pServer) + { + pServer->RemoveElement(iClientSID); + } // Clear up any outstanding message HandleIPCClosingDownCallback(); @@ -159,7 +164,10 @@ // If the client has detached properly, they should // have done this - but just in case. //DoCancelWaitForCallback(); - Server().DropSession(); + if(pServer) + { + pServer->DropSession(); + } } void CABSession::CreateL() diff -r 883e91c086aa -r 48c22c726cf9 backupandrestore/backupengine/src/sbecompressionandencryption.cpp --- a/backupandrestore/backupengine/src/sbecompressionandencryption.cpp Tue Jul 06 15:13:34 2010 +0300 +++ b/backupandrestore/backupengine/src/sbecompressionandencryption.cpp Wed Aug 18 10:38:51 2010 +0300 @@ -709,7 +709,7 @@ iEncryptionHeader.iEncrypted, iEncryptionHeader.iBufferSize, iEncryptionHeader.iTotalSize); // Check we have a sensible encryption header - if ((iEncryptionHeader.iBufferSize < 0) || + if ((iEncryptionHeader.iBufferSize < 0) || (iEncryptionHeader.iBufferSize >= KMaxTInt/2) || (iEncryptionHeader.iTotalSize < 0)) { __LOG("CSBEDecompressAndEncrypt::CreateCipherL() - Corrupt data"); diff -r 883e91c086aa -r 48c22c726cf9 localconnectivityservice/dun/atext/group/dunatext.mmp --- a/localconnectivityservice/dun/atext/group/dunatext.mmp Tue Jul 06 15:13:34 2010 +0300 +++ b/localconnectivityservice/dun/atext/group/dunatext.mmp Wed Aug 18 10:38:51 2010 +0300 @@ -36,16 +36,10 @@ SOURCE DunAtNvramListen.cpp SOURCE DunAtSpecialCmdHandler.cpp -USERINCLUDE ../inc ../../utils/inc - MW_LAYER_SYSTEMINCLUDE -// Note: -// The only other SYSTEMINCLUDE should you shall add are Symbian specific ones. -// If there is a S60 header in the subdirectory then that should be -// added into the include statements (like #include ) -//SYSTEMINCLUDE /epoc32/include/ecom -SYSTEMINCLUDE ../../../inc +USERINCLUDE ../inc ../../utils/inc +USERINCLUDE ../../../inc LIBRARY atextclient.lib LIBRARY atextcommon.lib diff -r 883e91c086aa -r 48c22c726cf9 localconnectivityservice/dun/atext/src/DunAtCmdHandler.cpp --- a/localconnectivityservice/dun/atext/src/DunAtCmdHandler.cpp Tue Jul 06 15:13:34 2010 +0300 +++ b/localconnectivityservice/dun/atext/src/DunAtCmdHandler.cpp Wed Aug 18 10:38:51 2010 +0300 @@ -855,20 +855,6 @@ FTRACE(FPrint( _L("CDunAtCmdHandler::ExtractLineFromInputBuffer() (more needed) complete") )); return ETrue; } - // As a last step adjust the possible multiple IsDelimiterCharacter() - // characters and set length of iLineBuffer. Leave iEndIndex untouched. - lineLength = iLineBuffer.Length(); - for ( TInt i=lineLength-1; i>=0; i-- ) - { - TChar character = iLineBuffer[i]; - if ( !IsDelimiterCharacter(character) ) - { - iLineBuffer.SetLength( i + 1 ); - FTRACE(FPrint( _L("CDunAtCmdHandler::ExtractLineFromInputBuffer() after (%d bytes):"), iLineBuffer.Length() )); - FTRACE(FPrintRaw(iLineBuffer) ); - break; - } - } FTRACE(FPrint( _L("CDunAtCmdHandler::ExtractLineFromInputBuffer() (line found) complete") )); return EFalse; } @@ -1413,9 +1399,25 @@ { iDecodeInfo.iExtendedIndex = aEndIndex; SaveFoundCharDecodeState( aCharacter ); - FTRACE(FPrint( _L("CDunAtCmdHandler::IsExtendedBorder() (no border) complete") )); + FTRACE(FPrint( _L("CDunAtCmdHandler::IsExtendedBorder() (no border normal) complete") )); return EFalse; } + // Now suspect border found so peek the next character after the suspected + // extended character. If it is not alphabetical character, return with EFalse. + // This case is to detect the cases such as "AT+VTS={*,3000}", where '*' would + // be the start of the next command in normal cases. + TInt peekIndex = aEndIndex + 1; + TInt lineLength = iLineBuffer.Length(); + if ( peekIndex < lineLength ) + { + TChar nextCharacter = iLineBuffer[peekIndex]; + if ( !nextCharacter.IsAlpha() ) + { + SaveFoundCharDecodeState( aCharacter ); + FTRACE(FPrint( _L("CDunAtCmdHandler::IsExtendedBorder() (no border special) complete") )); + return EFalse; + } + } aEndIndex--; FTRACE(FPrint( _L("CDunAtCmdHandler::IsExtendedBorder() (border) complete") )); return ETrue; diff -r 883e91c086aa -r 48c22c726cf9 localconnectivityservice/dun/client/group/dunclient.mmp --- a/localconnectivityservice/dun/client/group/dunclient.mmp Tue Jul 06 15:13:34 2010 +0300 +++ b/localconnectivityservice/dun/client/group/dunclient.mmp Wed Aug 18 10:38:51 2010 +0300 @@ -36,16 +36,10 @@ TARGET dunclient.rsc END // RESOURCE -USERINCLUDE ../inc ../../utils/inc - MW_LAYER_SYSTEMINCLUDE -// Note: -// The only other SYSTEMINCLUDE should you shall add are Symbian specific ones. -// If there is a S60 header in the subdirectory then that should be -// added into the include statements (like #include ) -//SYSTEMINCLUDE /epoc32/include/ecom -SYSTEMINCLUDE ../../../inc ../../../../inc /epoc32/include/ecom +USERINCLUDE ../inc ../../utils/inc +USERINCLUDE ../../../inc ../../../../inc LIBRARY euser.lib LIBRARY ecom.lib diff -r 883e91c086aa -r 48c22c726cf9 localconnectivityservice/dun/client/src/0x20002775.rss --- a/localconnectivityservice/dun/client/src/0x20002775.rss Tue Jul 06 15:13:34 2010 +0300 +++ b/localconnectivityservice/dun/client/src/0x20002775.rss Wed Aug 18 10:38:51 2010 +0300 @@ -16,8 +16,8 @@ */ -#include "registryinfov2.rh" -#include "locodplugin.hrh" +#include +#include RESOURCE REGISTRY_INFO theInfo { diff -r 883e91c086aa -r 48c22c726cf9 localconnectivityservice/dun/client/src/proxy.cpp --- a/localconnectivityservice/dun/client/src/proxy.cpp Tue Jul 06 15:13:34 2010 +0300 +++ b/localconnectivityservice/dun/client/src/proxy.cpp Wed Aug 18 10:38:51 2010 +0300 @@ -16,7 +16,7 @@ */ -#include //ECom header file +#include //ECom header file #include "dunplugin.h" // --------------------------------------------------------------------------- diff -r 883e91c086aa -r 48c22c726cf9 localconnectivityservice/dun/plugins/group/dunbt.mmp --- a/localconnectivityservice/dun/plugins/group/dunbt.mmp Tue Jul 06 15:13:34 2010 +0300 +++ b/localconnectivityservice/dun/plugins/group/dunbt.mmp Wed Aug 18 10:38:51 2010 +0300 @@ -29,16 +29,10 @@ SOURCE DunBtPlugin.cpp SOURCE DunBtListen.cpp -USERINCLUDE ../inc/bt ../../utils/inc - MW_LAYER_SYSTEMINCLUDE -// Note: -// The only other SYSTEMINCLUDE should you shall add are Symbian specific ones. -// If there is a S60 header in the subdirectory then that should be -// added into the include statements (like #include ) -//SYSTEMINCLUDE /epoc32/include/ecom -SYSTEMINCLUDE ../../../inc +USERINCLUDE ../inc/bt ../../utils/inc +USERINCLUDE ../../../inc LIBRARY euser.lib LIBRARY esock.lib diff -r 883e91c086aa -r 48c22c726cf9 localconnectivityservice/dun/plugins/group/dunir.mmp --- a/localconnectivityservice/dun/plugins/group/dunir.mmp Tue Jul 06 15:13:34 2010 +0300 +++ b/localconnectivityservice/dun/plugins/group/dunir.mmp Wed Aug 18 10:38:51 2010 +0300 @@ -28,16 +28,10 @@ SOURCEPATH ../src/ir SOURCE DunIrPlugin.cpp -USERINCLUDE ../inc/ir ../../utils/inc - MW_LAYER_SYSTEMINCLUDE -// Note: -// The only other SYSTEMINCLUDE should you shall add are Symbian specific ones. -// If there is a S60 header in the subdirectory then that should be -// added into the include statements (like #include ) -//SYSTEMINCLUDE /epoc32/include/ecom -SYSTEMINCLUDE ../../../inc +USERINCLUDE ../inc/ir ../../utils/inc +USERINCLUDE ../../../inc LIBRARY euser.lib LIBRARY c32.lib diff -r 883e91c086aa -r 48c22c726cf9 localconnectivityservice/dun/plugins/group/dunusb.mmp --- a/localconnectivityservice/dun/plugins/group/dunusb.mmp Tue Jul 06 15:13:34 2010 +0300 +++ b/localconnectivityservice/dun/plugins/group/dunusb.mmp Wed Aug 18 10:38:51 2010 +0300 @@ -30,16 +30,10 @@ SOURCE DunUsbListen.cpp SOURCE DunUsbConfig.cpp -USERINCLUDE ../inc/usb ../../utils/inc - MW_LAYER_SYSTEMINCLUDE -// Note: -// The only other SYSTEMINCLUDE should you shall add are Symbian specific ones. -// If there is a S60 header in the subdirectory then that should be -// added into the include statements (like #include ) -//SYSTEMINCLUDE /epoc32/include/ecom -SYSTEMINCLUDE ../../../inc +USERINCLUDE ../inc/usb ../../utils/inc +USERINCLUDE ../../../inc LIBRARY euser.lib LIBRARY c32.lib diff -r 883e91c086aa -r 48c22c726cf9 localconnectivityservice/dun/server/group/dunserver.mmp --- a/localconnectivityservice/dun/server/group/dunserver.mmp Tue Jul 06 15:13:34 2010 +0300 +++ b/localconnectivityservice/dun/server/group/dunserver.mmp Wed Aug 18 10:38:51 2010 +0300 @@ -31,16 +31,10 @@ SOURCE DunServerUtils.cpp SOURCE DunCloseWait.cpp -USERINCLUDE ../inc ../../utils/inc - MW_LAYER_SYSTEMINCLUDE -// Note: -// The only other SYSTEMINCLUDE should you shall add are Symbian specific ones. -// If there is a S60 header in the subdirectory then that should be -// added into the include statements (like #include ) -//SYSTEMINCLUDE /epoc32/include/ecom -SYSTEMINCLUDE ../../../inc ../../../../inc +USERINCLUDE ../inc ../../utils/inc +USERINCLUDE ../../../inc ../../../../inc LIBRARY euser.lib LIBRARY dunutils.lib diff -r 883e91c086aa -r 48c22c726cf9 localconnectivityservice/dun/tsrc/group/dunutilstest.mmp --- a/localconnectivityservice/dun/tsrc/group/dunutilstest.mmp Tue Jul 06 15:13:34 2010 +0300 +++ b/localconnectivityservice/dun/tsrc/group/dunutilstest.mmp Wed Aug 18 10:38:51 2010 +0300 @@ -21,20 +21,11 @@ CAPABILITY ALL -TCB -//TARGETPATH ?target_path DEFFILE dunutilstest.def USERINCLUDE ../inc ../../utils/inc -SYSTEMINCLUDE /epoc32/include/mw/hb/hbwidgets - -#if defined(__S60_) - // OSEXT_LAYER_SYSTEMINCLUDE - MW_LAYER_SYSTEMINCLUDE -#else - //SYSTEMINCLUDE /epoc32/include - //SYSTEMINCLUDE /epoc32/include/internal -#endif +MW_LAYER_SYSTEMINCLUDE SOURCEPATH ../src diff -r 883e91c086aa -r 48c22c726cf9 localconnectivityservice/dun/utils/group/dunutils.mmp --- a/localconnectivityservice/dun/utils/group/dunutils.mmp Tue Jul 06 15:13:34 2010 +0300 +++ b/localconnectivityservice/dun/utils/group/dunutils.mmp Wed Aug 18 10:38:51 2010 +0300 @@ -54,17 +54,10 @@ SOURCE DunNoteHandler.cpp SOURCE DunUtils.cpp -USERINCLUDE ../inc ../../atext/inc - MW_LAYER_SYSTEMINCLUDE -// Note: -// The only other SYSTEMINCLUDE should you shall add are Symbian specific ones. -// If there is a S60 header in the subdirectory then that should be -// added into the include statements (like #include ) -//SYSTEMINCLUDE /epoc32/include/ecom -SYSTEMINCLUDE ../../../inc -SYSTEMINCLUDE /epoc32/include/mw/hb/hbwidgets +USERINCLUDE ../inc ../../atext/inc +USERINCLUDE ../../../inc LIBRARY bafl.lib #ifdef PRJ_USE_NETWORK_STUBS diff -r 883e91c086aa -r 48c22c726cf9 localconnectivityservice/dun/utils/inc/DunNoteHandler.h --- a/localconnectivityservice/dun/utils/inc/DunNoteHandler.h Tue Jul 06 15:13:34 2010 +0300 +++ b/localconnectivityservice/dun/utils/inc/DunNoteHandler.h Wed Aug 18 10:38:51 2010 +0300 @@ -20,7 +20,7 @@ #define C_CDUNNOTEHANDLER_H #include -#include +#include #include "DunTransporter.h" /** diff -r 883e91c086aa -r 48c22c726cf9 localconnectivityservice/generichid/group/generichid.mmp --- a/localconnectivityservice/generichid/group/generichid.mmp Tue Jul 06 15:13:34 2010 +0300 +++ b/localconnectivityservice/generichid/group/generichid.mmp Wed Aug 18 10:38:51 2010 +0300 @@ -41,11 +41,10 @@ SOURCE hidinterfaces.cpp SOURCE hidconnectioninfo.cpp -USERINCLUDE ../inc +MW_LAYER_SYSTEMINCLUDE -MW_LAYER_SYSTEMINCLUDE -SYSTEMINCLUDE ../../../inc -SYSTEMINCLUDE /epoc32/include/ecom +USERINCLUDE ../inc +USERINCLUDE ../../../inc LIBRARY euser.lib LIBRARY ecom.lib diff -r 883e91c086aa -r 48c22c726cf9 localconnectivityservice/generichid/tsrc/GenericHidTest/group/CHidDriverPlugin.mmp --- a/localconnectivityservice/generichid/tsrc/GenericHidTest/group/CHidDriverPlugin.mmp Tue Jul 06 15:13:34 2010 +0300 +++ b/localconnectivityservice/generichid/tsrc/GenericHidTest/group/CHidDriverPlugin.mmp Wed Aug 18 10:38:51 2010 +0300 @@ -33,7 +33,6 @@ USERINCLUDE ../inc USERINCLUDE ../../../inc -SYSTEMINCLUDE /epoc32/include/ecom MW_LAYER_SYSTEMINCLUDE diff -r 883e91c086aa -r 48c22c726cf9 localconnectivityservice/generichid/tsrc/GenericHidTest/group/GenericHidTest.mmp --- a/localconnectivityservice/generichid/tsrc/GenericHidTest/group/GenericHidTest.mmp Tue Jul 06 15:13:34 2010 +0300 +++ b/localconnectivityservice/generichid/tsrc/GenericHidTest/group/GenericHidTest.mmp Wed Aug 18 10:38:51 2010 +0300 @@ -36,8 +36,6 @@ USERINCLUDE ../inc USERINCLUDE ../../../inc -SYSTEMINCLUDE /epoc32/include/internal - SOURCEPATH ../src SOURCE GenericHidTest.cpp SOURCE GenericHidTestBlocks.cpp diff -r 883e91c086aa -r 48c22c726cf9 localconnectivityservice/headset/group/hidheadset.mmp --- a/localconnectivityservice/headset/group/hidheadset.mmp Tue Jul 06 15:13:34 2010 +0300 +++ b/localconnectivityservice/headset/group/hidheadset.mmp Wed Aug 18 10:38:51 2010 +0300 @@ -36,14 +36,14 @@ TARGET hidheadset.rsc END // ECOM resource definition -USERINCLUDE ../inc ../hidremconbearer/inc - #ifdef NO101APPDEPFIXES APP_LAYER_SYSTEMINCLUDE #else //NO101APPDEPFIXES MW_LAYER_SYSTEMINCLUDE #endif //NO101APPDEPFIXES -SYSTEMINCLUDE ../../../inc + +USERINCLUDE ../inc ../hidremconbearer/inc +USERINCLUDE ../../../inc LIBRARY euser.lib LIBRARY ecom.lib diff -r 883e91c086aa -r 48c22c726cf9 localconnectivityservice/locod/commoninc/locodbearerplugin.inl --- a/localconnectivityservice/locod/commoninc/locodbearerplugin.inl Tue Jul 06 15:13:34 2010 +0300 +++ b/localconnectivityservice/locod/commoninc/locodbearerplugin.inl Wed Aug 18 10:38:51 2010 +0300 @@ -17,7 +17,7 @@ */ -#include +#include // ----------------------------------------------------------------------------- // Creates the bearer plug ins and return it to caller diff -r 883e91c086aa -r 48c22c726cf9 localconnectivityservice/locod/commoninc/locodserviceplugin.inl --- a/localconnectivityservice/locod/commoninc/locodserviceplugin.inl Tue Jul 06 15:13:34 2010 +0300 +++ b/localconnectivityservice/locod/commoninc/locodserviceplugin.inl Wed Aug 18 10:38:51 2010 +0300 @@ -17,7 +17,7 @@ */ -#include +#include // ----------------------------------------------------------------------------- // Constructor method, just saves the arguments into member variables diff -r 883e91c086aa -r 48c22c726cf9 localconnectivityservice/locod/group/locod.mmp --- a/localconnectivityservice/locod/group/locod.mmp Tue Jul 06 15:13:34 2010 +0300 +++ b/localconnectivityservice/locod/group/locod.mmp Wed Aug 18 10:38:51 2010 +0300 @@ -33,9 +33,9 @@ SOURCE locodserviceman.cpp SOURCE locodservice.cpp -USERINCLUDE ../inc -SYSTEMINCLUDE ../../inc ../../../inc -SYSTEMINCLUDE /epoc32/include/ecom +USERINCLUDE ../inc +USERINCLUDE ../../inc ../../../inc + MW_LAYER_SYSTEMINCLUDE LIBRARY euser.lib diff -r 883e91c086aa -r 48c22c726cf9 mtpdataproviders/mtpfileandfolderdp/src/cmtpfiledpexclusionmgr.cpp --- a/mtpdataproviders/mtpfileandfolderdp/src/cmtpfiledpexclusionmgr.cpp Tue Jul 06 15:13:34 2010 +0300 +++ b/mtpdataproviders/mtpfileandfolderdp/src/cmtpfiledpexclusionmgr.cpp Wed Aug 18 10:38:51 2010 +0300 @@ -96,7 +96,7 @@ formatcode = playbackFormatExclusionList[index]; if(KErrNotFound == capFormatExclusionList.FindInOrder(formatcode)) { - capFormatExclusionList.InsertInOrder(formatcode); + capFormatExclusionList.InsertInOrderL(formatcode); } } diff -r 883e91c086aa -r 48c22c726cf9 mtpdataproviders/mtpimagedp/inc/cmtpimagedp.h --- a/mtpdataproviders/mtpimagedp/inc/cmtpimagedp.h Tue Jul 06 15:13:34 2010 +0300 +++ b/mtpdataproviders/mtpimagedp/inc/cmtpimagedp.h Wed Aug 18 10:38:51 2010 +0300 @@ -67,6 +67,7 @@ void HandleDeleteObjectsArray(); void IncreaseNewPictures(TInt aCount); void DecreaseNewPictures(TInt aCount); + void ResetNewPictures(); void HandleMdeSessionCompleteL(TInt aError); public: // From CMTPDataProviderPlugin @@ -129,6 +130,7 @@ TBool iEnumerationNotified; RPointerArray iDeleteObjectsArray; + RArray iNewPicHandles; }; #endif // CMTPIMAGEDP_H diff -r 883e91c086aa -r 48c22c726cf9 mtpdataproviders/mtpimagedp/inc/cmtpimagedpgetobject.h --- a/mtpdataproviders/mtpimagedp/inc/cmtpimagedpgetobject.h Tue Jul 06 15:13:34 2010 +0300 +++ b/mtpdataproviders/mtpimagedp/inc/cmtpimagedpgetobject.h Wed Aug 18 10:38:51 2010 +0300 @@ -42,6 +42,7 @@ void ServiceL(); TBool DoHandleCompletingPhaseL(); + TMTPResponseCode CheckRequestL(); private: diff -r 883e91c086aa -r 48c22c726cf9 mtpdataproviders/mtpimagedp/src/cmtpimagedp.cpp --- a/mtpdataproviders/mtpimagedp/src/cmtpimagedp.cpp Tue Jul 06 15:13:34 2010 +0300 +++ b/mtpdataproviders/mtpimagedp/src/cmtpimagedp.cpp Wed Aug 18 10:38:51 2010 +0300 @@ -120,8 +120,10 @@ } //Define RProperty of new pictures for status data provider + RProcess process; + TUid tSid = process.SecureId(); _LIT_SECURITY_POLICY_PASS(KAllowReadAll); - TInt error = RProperty::Define(KMTPNewPicKey, RProperty::EInt, KAllowReadAll, KAllowReadAll); + TInt error = RProperty::Define(tSid, KMTPNewPicKey, RProperty::EInt, KAllowReadAll, KAllowReadAll); if (error != KErrNone && error != KErrAlreadyExists) { __FLOG_1(_L8("CMTPImageDataProvider::ConstructL - RProperty define error:%d"), error); @@ -165,6 +167,7 @@ //Try to delete objects in array HandleDeleteObjectsArray(); iDeleteObjectsArray.ResetAndDestroy(); + iNewPicHandles.Reset(); __FLOG(_L8("<< ~CMTPImageDataProvider")); __FLOG_CLOSE; @@ -610,8 +613,7 @@ /** * Get image object count from framework and calculate the new pictures */ - TUint newPictures = QueryImageObjectCountL(); - RProperty::Set(TUid::Uid(KMTPServerUID), KMTPNewPicKey, newPictures); + TUint newPictures = QueryImageObjectCountL(); iNewPicNotifier->SetNewPictures(newPictures); __FLOG_1(_L16("CMTPImageDpEnumerator::CompleteEnumeration - New Pics: %d"), newPictures); iEnumerated = EFalse; @@ -693,6 +695,8 @@ CleanupClosePushL(context); CleanupClosePushL(handles); + iNewPicHandles.Reset(); + do { /* @@ -712,6 +716,7 @@ if (MTPImageDpUtilits::IsNewPicture(*objMetadata)) { ++newPictures; + iNewPicHandles.Append(handles[i]); } } @@ -765,6 +770,32 @@ __FLOG(_L8("<< DecreaseNewPictures ")); } +void CMTPImageDataProvider::ResetNewPictures() + { + __FLOG(_L8(">> ResetNewPictures ")); + + iNewPicNotifier->SetNewPictures(0); + + TInt count = iNewPicHandles.Count(); + if (!count) + { + return; + } + + CMTPObjectMetaData* objMetadata = CMTPObjectMetaData::NewLC(); + + for (TInt i(0); i> HandleMdeSessionComplete")); diff -r 883e91c086aa -r 48c22c726cf9 mtpdataproviders/mtpimagedp/src/cmtpimagedpcopyobject.cpp --- a/mtpdataproviders/mtpimagedp/src/cmtpimagedpcopyobject.cpp Tue Jul 06 15:13:34 2010 +0300 +++ b/mtpdataproviders/mtpimagedp/src/cmtpimagedpcopyobject.cpp Wed Aug 18 10:38:51 2010 +0300 @@ -190,7 +190,7 @@ GetPreviousPropertiesL(aOldFileName); User::LeaveIfError(iFileMan->Copy(aOldFileName, *iDest)); - iRollbackActionL.Append(RollBackFromFsL); + iRollbackActionL.AppendL(RollBackFromFsL); SetPreviousPropertiesL(aNewFileName); iFramework.ObjectMgr().InsertObjectL(*iTargetObjectInfo); diff -r 883e91c086aa -r 48c22c726cf9 mtpdataproviders/mtpimagedp/src/cmtpimagedpdeleteobject.cpp --- a/mtpdataproviders/mtpimagedp/src/cmtpimagedpdeleteobject.cpp Tue Jul 06 15:13:34 2010 +0300 +++ b/mtpdataproviders/mtpimagedp/src/cmtpimagedpdeleteobject.cpp Wed Aug 18 10:38:51 2010 +0300 @@ -205,7 +205,7 @@ iFramework.ObjectMgr().GetObjectHandlesL( params, context, handles ); for ( TInt i = 0; i < handles.Count(); i++) { - iObjectsToDelete.Append( handles[i] ); + iObjectsToDelete.AppendL( handles[i] ); } } while ( !context.QueryComplete() ); diff -r 883e91c086aa -r 48c22c726cf9 mtpdataproviders/mtpimagedp/src/cmtpimagedpgetobject.cpp --- a/mtpdataproviders/mtpimagedp/src/cmtpimagedpgetobject.cpp Tue Jul 06 15:13:34 2010 +0300 +++ b/mtpdataproviders/mtpimagedp/src/cmtpimagedpgetobject.cpp Wed Aug 18 10:38:51 2010 +0300 @@ -93,7 +93,22 @@ __FLOG(_L8(">> CMTPImageDpGetObject::ConstructL")); __FLOG(_L8("<< CMTPImageDpGetObject::ConstructL")); } - +TMTPResponseCode CMTPImageDpGetObject::CheckRequestL() + { + __FLOG(_L8(">> CMTPImageDpGetObject::CheckRequestL")); + TMTPResponseCode responseCode = CMTPRequestProcessor::CheckRequestL(); + + TUint32 handle(Request().Uint32(TMTPTypeRequest::ERequestParameter1)); + if ( handle != KMTPHandleAll ) + { + CMTPObjectMetaData* ObjectMeta = CMTPObjectMetaData::NewL(); + responseCode = MTPImageDpUtilits::VerifyObjectHandleL( + iFramework, handle, *ObjectMeta); + delete ObjectMeta; + } + __FLOG(_L8("<< CMTPImageDpGetObject::CheckRequestL")); + return responseCode; + } /** GetObject request handler */ @@ -140,7 +155,7 @@ { //update new picture status MTPImageDpUtilits::UpdateObjectStatusToOldL(iFramework, *objectInfo); - iDataProvider.DecreaseNewPictures(1); + iDataProvider.ResetNewPictures(); } } diff -r 883e91c086aa -r 48c22c726cf9 mtpdataproviders/mtpimagedp/src/cmtpimagedpgetobjectinfo.cpp --- a/mtpdataproviders/mtpimagedp/src/cmtpimagedpgetobjectinfo.cpp Tue Jul 06 15:13:34 2010 +0300 +++ b/mtpdataproviders/mtpimagedp/src/cmtpimagedpgetobjectinfo.cpp Wed Aug 18 10:38:51 2010 +0300 @@ -114,17 +114,17 @@ iObjectPropertyMgr.SetCurrentObjectL(*iObjectMeta, EFalse); //1. storage id - TUint32 storageId; + TUint32 storageId(0); iObjectPropertyMgr.GetPropertyL(EMTPObjectPropCodeStorageID, storageId); iObjectInfoToBuild->SetUint32L(CMTPTypeObjectInfo::EStorageID, storageId); //2. object format - TUint16 format; + TUint16 format(0); iObjectPropertyMgr.GetPropertyL(EMTPObjectPropCodeObjectFormat, format); iObjectInfoToBuild->SetUint16L(CMTPTypeObjectInfo::EObjectFormat, format); //3. protection status, - TUint16 protection; + TUint16 protection(0); iObjectPropertyMgr.GetPropertyL(EMTPObjectPropCodeProtectionStatus, protection); iObjectInfoToBuild->SetUint16L(CMTPTypeObjectInfo::EProtectionStatus, protection); @@ -138,7 +138,7 @@ //9. image pix width //10. image pix height //11. image bit depth - TUint16 thumbFormat; + TUint16 thumbFormat(0); iObjectPropertyMgr.GetPropertyL(EMTPObjectPropCodeRepresentativeSampleFormat, thumbFormat); iObjectInfoToBuild->SetUint16L(CMTPTypeObjectInfo::EThumbFormat, thumbFormat); TUint32 value(0); @@ -157,7 +157,7 @@ iObjectInfoToBuild->SetUint32L(CMTPTypeObjectInfo::EImageBitDepth, value); //12. Parent object - TUint32 parent; + TUint32 parent(0); iObjectPropertyMgr.GetPropertyL(EMTPObjectPropCodeParentObject, parent); if(KMTPHandleNoParent == parent) { diff -r 883e91c086aa -r 48c22c726cf9 mtpdataproviders/mtpimagedp/src/cmtpimagedpgetobjectproplist.cpp --- a/mtpdataproviders/mtpimagedp/src/cmtpimagedpgetobjectproplist.cpp Tue Jul 06 15:13:34 2010 +0300 +++ b/mtpdataproviders/mtpimagedp/src/cmtpimagedpgetobjectproplist.cpp Wed Aug 18 10:38:51 2010 +0300 @@ -207,7 +207,7 @@ } else { - iHandles.Append( handle ); + iHandles.AppendL( handle ); } __FLOG(_L8("<< CMTPImageDpGetObjectPropList::GetObjectHandlesL")); diff -r 883e91c086aa -r 48c22c726cf9 mtpdataproviders/mtpimagedp/src/cmtpimagedpnewpicturesnotifier.cpp --- a/mtpdataproviders/mtpimagedp/src/cmtpimagedpnewpicturesnotifier.cpp Tue Jul 06 15:13:34 2010 +0300 +++ b/mtpdataproviders/mtpimagedp/src/cmtpimagedpnewpicturesnotifier.cpp Wed Aug 18 10:38:51 2010 +0300 @@ -44,6 +44,7 @@ void CMTPImageDpNewPicturesNotifier::SetNewPictures(TInt aValue) { iNewPictures = aValue; + RProperty::Set(TUid::Uid(KMTPServerUID), KMTPNewPicKey, iNewPictures); } void CMTPImageDpNewPicturesNotifier::IncreaseCount(TInt aValue) diff -r 883e91c086aa -r 48c22c726cf9 mtpdataproviders/mtpimagedp/src/cmtpimagedpobjectpropertymgr.cpp --- a/mtpdataproviders/mtpimagedp/src/cmtpimagedpobjectpropertymgr.cpp Tue Jul 06 15:13:34 2010 +0300 +++ b/mtpdataproviders/mtpimagedp/src/cmtpimagedpobjectpropertymgr.cpp Wed Aug 18 10:38:51 2010 +0300 @@ -68,7 +68,9 @@ CMTPImageDpObjectPropertyMgr::CMTPImagePropertiesCache* CMTPImageDpObjectPropertyMgr::CMTPImagePropertiesCache::NewL() { CMTPImagePropertiesCache* self = new(ELeave) CMTPImagePropertiesCache(KElements, ENumProperties); + CleanupStack::PushL(self); self->ConstructL(); + CleanupStack::Pop(self); return self; } diff -r 883e91c086aa -r 48c22c726cf9 mtpdataproviders/mtpimagedp/src/cmtpimagedpsendobjectinfo.cpp --- a/mtpdataproviders/mtpimagedp/src/cmtpimagedpsendobjectinfo.cpp Tue Jul 06 15:13:34 2010 +0300 +++ b/mtpdataproviders/mtpimagedp/src/cmtpimagedpsendobjectinfo.cpp Wed Aug 18 10:38:51 2010 +0300 @@ -23,7 +23,6 @@ #include #include - #include #include #include @@ -515,7 +514,7 @@ iFramework.ObjectMgr().CommitReservedObjectHandleL(*iReceivedObject); //prepare for rollback - iRollbackList.Append(RemoveObjectFromDb); + iRollbackList.AppendL(RemoveObjectFromDb); ReceiveDataL(*iFileReceived); @@ -1196,7 +1195,7 @@ iFramework.ObjectMgr().ReserveObjectHandleL(*iReceivedObject, iObjectSize); // prepare for rollback - iRollbackList.Append(UnreserveObject); + iRollbackList.AppendL(UnreserveObject); __FLOG(_L8("CMTPImageDpSendObjectInfo::ReserveObjectL - Exit")); } @@ -1257,7 +1256,7 @@ delete iFileReceived; iFileReceived = NULL; //prepare for rollback - iRollbackList.Append(RemoveObjectFromFs); + iRollbackList.AppendL(RemoveObjectFromFs); iFileReceived = CMTPTypeFile::NewL(iFramework.Fs(), iFullPath, EFileWrite); iFileReceived->SetSizeL(iObjectSize); diff -r 883e91c086aa -r 48c22c726cf9 mtpdataproviders/mtppictbridgedp/inc/s60dependency.h --- a/mtpdataproviders/mtppictbridgedp/inc/s60dependency.h Tue Jul 06 15:13:34 2010 +0300 +++ b/mtpdataproviders/mtppictbridgedp/inc/s60dependency.h Wed Aug 18 10:38:51 2010 +0300 @@ -24,7 +24,7 @@ #include -#include +#include #include #include #include diff -r 883e91c086aa -r 48c22c726cf9 mtpdataproviders/mtppictbridgedp/src/cmtppictbridgedpsendobjectinfo.cpp --- a/mtpdataproviders/mtppictbridgedp/src/cmtppictbridgedpsendobjectinfo.cpp Tue Jul 06 15:13:34 2010 +0300 +++ b/mtpdataproviders/mtppictbridgedp/src/cmtppictbridgedpsendobjectinfo.cpp Wed Aug 18 10:38:51 2010 +0300 @@ -659,7 +659,16 @@ //with folder creation. - iFramework.ObjectMgr().CommitReservedObjectHandleL(*iReceivedObjectP); + TRAPD(err, iFramework.ObjectMgr().CommitReservedObjectHandleL(*iReceivedObjectP)); + __FLOG_VA((_L8(" Entry error %d"),err)); + if( KErrAlreadyExists == err ) + { + iReceivedObjectP->SetUint(CMTPObjectMetaData::EHandle, iFramework.ObjectMgr().HandleL(iFullPath)); + } + else + { + User::LeaveIfError(err); + } SendResponseL(EMTPRespCodeOK); } __FLOG(_L8("<< CMTPPictGetObjectPropDesc::DoHandleSendObjectCompleteL")); diff -r 883e91c086aa -r 48c22c726cf9 mtpdataproviders/mtppictbridgedp/src/cmtppictbridgeusbconnection.cpp --- a/mtpdataproviders/mtppictbridgedp/src/cmtppictbridgeusbconnection.cpp Tue Jul 06 15:13:34 2010 +0300 +++ b/mtpdataproviders/mtppictbridgedp/src/cmtppictbridgeusbconnection.cpp Wed Aug 18 10:38:51 2010 +0300 @@ -78,13 +78,19 @@ // void CMTPPictBridgeUsbConnection::Listen() { - iProperty.Subscribe(iStatus); - SetActive(); - if(ConnectionClosed()) // we listen to the disconnection only if connected to the printer + __FLOG(_L8(">> CMTPPictBridgeUsbConnection::Listen")); + if(!IsActive()) { - iPrinter.ConnectionClosed(); - Cancel(); + __FLOG(_L8(" CMTPPictBridgeUsbConnection AO is NOT active and run AO")); + iProperty.Subscribe(iStatus); + SetActive(); + if(ConnectionClosed()) // we listen to the disconnection only if connected to the printer + { + iPrinter.ConnectionClosed(); + Cancel(); + } } + __FLOG(_L8("<< CMTPPictBridgeUsbConnection::Listen")); } // -------------------------------------------------------------------------- @@ -97,12 +103,14 @@ TInt ret = RProperty::Get(KPSUidUsbWatcher, KUsbWatcherSelectedPersonality, personality); __FLOG_VA((_L8("CMTPPictBridgeUsbConnection::ConnectionClosed() current personality = %d, previous personality = %d"), personality, iPreviousPersonality)); - if ((ret == KErrNone && - (personality == KUsbPersonalityIdMS || personality == KUsbPersonalityIdPTP)) + if ((ret == KErrNone && personality == KUsbPersonalityIdMS) || (iPreviousPersonality != KNotAssigned && personality != iPreviousPersonality)) - { - __FLOG_VA((_L8("****WARNING!!! PTP server detects the USB connection closed!"))); - return ETrue; + { + if((personality != KUsbPersonalityIdPCSuiteMTP)&&(personality != KUsbPersonalityIdMTP)) + { + __FLOG_VA((_L8("****WARNING!!! PTP server detects the USB connection closed!"))); + return ETrue; + } } iPreviousPersonality = personality; diff -r 883e91c086aa -r 48c22c726cf9 mtpfws/mtpfw/common/inc/uiklafinternalcrkeys.h --- a/mtpfws/mtpfw/common/inc/uiklafinternalcrkeys.h Tue Jul 06 15:13:34 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,94 +0,0 @@ -/* -* 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; - -#ifdef __MTP_NAVIENGINE_TEST -//The free size of C-Drive of NaviEngine env is less than 21M, -//it will block many ONB test cases -const TInt KFreeSpaceThreshHoldDefaultValue(0); -const TInt KFreeSpaceExtraReserved(0); - -#else -//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 - -#endif __UIKLAF_INTERNAL_CR_KEYS_H__ - -// End of file diff -r 883e91c086aa -r 48c22c726cf9 mtpfws/mtpfw/dataproviders/devdp/inc/cmtpgetnumobjects.h --- a/mtpfws/mtpfw/dataproviders/devdp/inc/cmtpgetnumobjects.h Tue Jul 06 15:13:34 2010 +0300 +++ b/mtpfws/mtpfw/dataproviders/devdp/inc/cmtpgetnumobjects.h Wed Aug 18 10:38:51 2010 +0300 @@ -49,10 +49,12 @@ CMTPGetNumObjects(MMTPDataProviderFramework& aFramework, MMTPConnection& aConnection); void ConstructL(); + void HandleObjectHandlesUnderMacL(CMTPTypeArray &aObjectHandles); private: TBool IsSupportedFormatL(TUint32 aFormatCode); + void GetObjectHandlesByFormatCodeL(TUint32 aFormatCode, CMTPTypeArray &aObjectHandles); protected: /** diff -r 883e91c086aa -r 48c22c726cf9 mtpfws/mtpfw/dataproviders/devdp/src/cmtpdevicedp.cpp --- a/mtpfws/mtpfw/dataproviders/devdp/src/cmtpdevicedp.cpp Tue Jul 06 15:13:34 2010 +0300 +++ b/mtpfws/mtpfw/dataproviders/devdp/src/cmtpdevicedp.cpp Wed Aug 18 10:38:51 2010 +0300 @@ -388,7 +388,9 @@ if(extnpluginMap ) { - iExtnPluginMapArray.Append(extnpluginMap); + CleanupStack::PushL(extnpluginMap); + iExtnPluginMapArray.AppendL(extnpluginMap); + CleanupStack::Pop(extnpluginMap); } } @@ -481,7 +483,7 @@ __ASSERT_ALWAYS( isFolder, User::Leave( KErrArgument )); __ASSERT_ALWAYS( aParentHandle != KMTPHandleNone, User::Leave( KErrArgument )); - __ASSERT_ALWAYS( Framework().StorageMgr().ValidStorageId( aStorageId ), User::Invariant()); + __ASSERT_ALWAYS( Framework().StorageMgr().ValidStorageId( aStorageId ), User::Leave( KErrArgument )); __FLOG_VA((_L16("Add Entry for Path:%S"), &aPath )); aObjectInfo.SetUint( CMTPObjectMetaData::EDataProviderId, Framework().DataProviderId() ); diff -r 883e91c086aa -r 48c22c726cf9 mtpfws/mtpfw/dataproviders/devdp/src/cmtpdevicedpconfigmgr.cpp --- a/mtpfws/mtpfw/dataproviders/devdp/src/cmtpdevicedpconfigmgr.cpp Tue Jul 06 15:13:34 2010 +0300 +++ b/mtpfws/mtpfw/dataproviders/devdp/src/cmtpdevicedpconfigmgr.cpp Wed Aug 18 10:38:51 2010 +0300 @@ -256,7 +256,7 @@ //Ignore the duplicate value. if( aOrderInfoArray.Find(formatInt) == KErrNotFound ) { - aOrderInfoArray.Append(formatInt); + aOrderInfoArray.AppendL(formatInt); } } } diff -r 883e91c086aa -r 48c22c726cf9 mtpfws/mtpfw/dataproviders/devdp/src/cmtpgetdeviceinfo.cpp --- a/mtpfws/mtpfw/dataproviders/devdp/src/cmtpgetdeviceinfo.cpp Tue Jul 06 15:13:34 2010 +0300 +++ b/mtpfws/mtpfw/dataproviders/devdp/src/cmtpgetdeviceinfo.cpp Wed Aug 18 10:38:51 2010 +0300 @@ -318,7 +318,7 @@ { supportedCaptureFormats.Remove(index); //insert at insertindex position to make sure that value inserted at begening. - supportedCaptureFormats.Insert(orderedFormats[orderedElements], insertIndex); + supportedCaptureFormats.InsertL(orderedFormats[orderedElements], insertIndex); insertIndex++; }//else nothing } @@ -381,7 +381,7 @@ { supportedPlaybackFormats.Remove(index); //insert at insertindex position to make sure that value inserted at begening. - supportedPlaybackFormats.Insert(orderedFormats[orderedElements], insertIndex); + supportedPlaybackFormats.InsertL(orderedFormats[orderedElements], insertIndex); insertIndex++; }//else nothing } diff -r 883e91c086aa -r 48c22c726cf9 mtpfws/mtpfw/dataproviders/devdp/src/cmtpgetnumobjects.cpp --- a/mtpfws/mtpfw/dataproviders/devdp/src/cmtpgetnumobjects.cpp Tue Jul 06 15:13:34 2010 +0300 +++ b/mtpfws/mtpfw/dataproviders/devdp/src/cmtpgetnumobjects.cpp Wed Aug 18 10:38:51 2010 +0300 @@ -13,6 +13,7 @@ // Description: // + #include #include #include @@ -153,18 +154,11 @@ if(iDevDpSingletons.DeviceDataStore().IsConnectMac() &&(KMTPFormatsAll == Request().Uint32(TMTPTypeRequest::ERequestParameter2))) { - //get folder count - TMTPObjectMgrQueryParams paramsFolder(Request().Uint32(TMTPTypeRequest::ERequestParameter1), EMTPFormatCodeAssociation, Request().Uint32(TMTPTypeRequest::ERequestParameter3)); - TUint32 count = iFramework.ObjectMgr().CountL(paramsFolder); - __FLOG_VA((_L8("ConnectMac and Fetch all, folder count = %d"), count)); - - //get script count - TMTPObjectMgrQueryParams paramsScript(Request().Uint32(TMTPTypeRequest::ERequestParameter1), EMTPFormatCodeScript, Request().Uint32(TMTPTypeRequest::ERequestParameter3)); - count += iFramework.ObjectMgr().CountL(paramsScript); - - //get Image file count - TMTPObjectMgrQueryParams paramsImage(Request().Uint32(TMTPTypeRequest::ERequestParameter1), EMTPFormatCodeEXIFJPEG, Request().Uint32(TMTPTypeRequest::ERequestParameter3)); - count += iFramework.ObjectMgr().CountL(paramsImage); + TUint32 count(0); + CMTPTypeArray *handles = CMTPTypeArray::NewLC(EMTPTypeAUINT32); + HandleObjectHandlesUnderMacL(*handles); + count = handles->NumElements(); + CleanupStack::PopAndDestroy(handles); __FLOG_VA((_L8("ConnectMac and Fetch all, total count = %d"), count)); SendResponseL(EMTPRespCodeOK, 1, &count); } @@ -201,26 +195,106 @@ } - - - - - - - - - - +/** +Handle special case under Mac. +Only expose the Folder, Image File and Viedo, Script under Drive:\Images, Drive\Viedos +*/ +void CMTPGetNumObjects::HandleObjectHandlesUnderMacL(CMTPTypeArray &aObjectHandles) + { + __FLOG(_L8("HandleObjectHandlesUnderMacL - Entry")); + + CMTPTypeArray* totalHandles = CMTPTypeArray::NewLC(EMTPTypeAUINT32); + + //get folder object handles + GetObjectHandlesByFormatCodeL(EMTPFormatCodeAssociation,*totalHandles); + + //get image/jpeg object handles + GetObjectHandlesByFormatCodeL(EMTPFormatCodeEXIFJPEG,*totalHandles); + //get image/bmp object handles + GetObjectHandlesByFormatCodeL(EMTPFormatCodeBMP,*totalHandles); + //get image/jif object handles + GetObjectHandlesByFormatCodeL(EMTPFormatCodeGIF,*totalHandles); + //get image/jpeg object handles + GetObjectHandlesByFormatCodeL(EMTPFormatCodePNG,*totalHandles); + + //get video/mp4 object handles + GetObjectHandlesByFormatCodeL(EMTPFormatCodeMP4Container,*totalHandles); + //get video/3gp object handles + GetObjectHandlesByFormatCodeL(EMTPFormatCode3GPContainer,*totalHandles); + //get video/wmv object handles + GetObjectHandlesByFormatCodeL(EMTPFormatCodeWMV,*totalHandles); + //get video/asf object handles + GetObjectHandlesByFormatCodeL(EMTPFormatCodeASF,*totalHandles); + + //Filer the folder list, ?:\\Images\\* and ?:\\Videos\\* + _LIT(KImagesFolderPre, "?:\\Images\\*"); + _LIT(KViedosFolderPre, "?:\\Videos\\*"); + + const TUint KCount(totalHandles->NumElements()); + + for (TUint i(0); (i < KCount); i++)//handles loop + { + CMTPObjectMetaData* object(CMTPObjectMetaData::NewLC()); + iFramework.ObjectMgr().ObjectL(totalHandles->ElementUint(i),*object); + const TDesC& suid(object->DesC(CMTPObjectMetaData::ESuid)); + +#ifdef __FLOG_ACTIVE + TBuf8 tmp; + tmp.Copy(suid); + __FLOG_VA((_L8("HandleObjectHandlesUnderMacL - suid: %S"), &tmp)); +#endif // __FLOG_ACTIVE + if((KErrNotFound != suid.MatchF(KImagesFolderPre)) || + (KErrNotFound != suid.MatchF(KViedosFolderPre))) + { + _LIT(KComma,","); + _LIT(KLineation,"-"); + _LIT(KUnderline,"_"); + _LIT(Ksemicolon ,";"); + if((KErrNotFound != suid.Find(KComma))|| + (KErrNotFound != suid.Find(KLineation))|| + (KErrNotFound != suid.Find(KUnderline))|| + (KErrNotFound != suid.Find(Ksemicolon))) + { + __FLOG(_L8("HandleObjectHandlesUnderMacL - Skip handle")); + } + else + { + __FLOG_VA((_L8("HandleObjectHandlesUnderMacL - Add handle: %x"), totalHandles->ElementUint(i))); + RArray tmphandles; + CleanupClosePushL(tmphandles); + tmphandles.AppendL(totalHandles->ElementUint(i)); + aObjectHandles.AppendL(tmphandles); + CleanupStack::PopAndDestroy(&tmphandles); + } + } + CleanupStack::PopAndDestroy(object); + } + + CleanupStack::PopAndDestroy(totalHandles); + //get script object handles + GetObjectHandlesByFormatCodeL(EMTPFormatCodeScript,aObjectHandles); + + __FLOG(_L8("HandleObjectHandlesUnderMacL - Exit")); + } +/** +Get Object Handles by format code +*/ +void CMTPGetNumObjects::GetObjectHandlesByFormatCodeL(TUint32 aFormatCode, CMTPTypeArray &aObjectHandles) + { + __FLOG_VA((_L8("GetObjectHandlesByFormatCodeL - Entry FormatCode: %x"), aFormatCode)); + RMTPObjectMgrQueryContext context; + RArray handles; + CleanupClosePushL(context); + CleanupClosePushL(handles); + TMTPObjectMgrQueryParams paramsFolder(Request().Uint32(TMTPTypeRequest::ERequestParameter1), aFormatCode, Request().Uint32(TMTPTypeRequest::ERequestParameter3)); + do + { + iFramework.ObjectMgr().GetObjectHandlesL(paramsFolder, context, handles); + aObjectHandles.AppendL(handles); + } + while (!context.QueryComplete()); + CleanupStack::PopAndDestroy(&context); + CleanupStack::PopAndDestroy(&handles); + __FLOG(_L8("GetObjectHandlesByFormatCode - Exit")); + } - - - - - - - - - - - - diff -r 883e91c086aa -r 48c22c726cf9 mtpfws/mtpfw/dataproviders/devdp/src/cmtpgetobjecthandles.cpp --- a/mtpfws/mtpfw/dataproviders/devdp/src/cmtpgetobjecthandles.cpp Tue Jul 06 15:13:34 2010 +0300 +++ b/mtpfws/mtpfw/dataproviders/devdp/src/cmtpgetobjecthandles.cpp Wed Aug 18 10:38:51 2010 +0300 @@ -107,10 +107,6 @@ iTimeoutCount = 0; - RMTPObjectMgrQueryContext context; - RArray handles; - CleanupClosePushL(context); - CleanupClosePushL(handles); delete iHandles; iHandles = CMTPTypeArray::NewL(EMTPTypeAUINT32); @@ -119,47 +115,14 @@ &&(KMTPFormatsAll == Request().Uint32(TMTPTypeRequest::ERequestParameter2))) { __FLOG(_L8("ConnectMac and Fetch all.")); - //get folder object handles - TMTPObjectMgrQueryParams paramsFolder(Request().Uint32(TMTPTypeRequest::ERequestParameter1), EMTPFormatCodeAssociation, Request().Uint32(TMTPTypeRequest::ERequestParameter3)); - do - { - iFramework.ObjectMgr().GetObjectHandlesL(paramsFolder, context, handles); - iHandles->AppendL(handles); - } - while (!context.QueryComplete()); - - //get script object handles - RMTPObjectMgrQueryContext contextScript; - RArray handlesScript; - CleanupClosePushL(contextScript); - CleanupClosePushL(handlesScript); - TMTPObjectMgrQueryParams paramsScript(Request().Uint32(TMTPTypeRequest::ERequestParameter1), EMTPFormatCodeScript, Request().Uint32(TMTPTypeRequest::ERequestParameter3)); - do - { - iFramework.ObjectMgr().GetObjectHandlesL(paramsScript, contextScript, handlesScript); - iHandles->AppendL(handlesScript); - } - while (!contextScript.QueryComplete()); - CleanupStack::PopAndDestroy(&contextScript); - CleanupStack::PopAndDestroy(&handlesScript); - - //get image object handles - RMTPObjectMgrQueryContext contextImage; - RArray handlesImage; - CleanupClosePushL(contextImage); - CleanupClosePushL(handlesImage); - TMTPObjectMgrQueryParams paramsImage(Request().Uint32(TMTPTypeRequest::ERequestParameter1), EMTPFormatCodeEXIFJPEG, Request().Uint32(TMTPTypeRequest::ERequestParameter3)); - do - { - iFramework.ObjectMgr().GetObjectHandlesL(paramsImage, contextImage, handlesImage); - iHandles->AppendL(handlesImage); - } - while (!contextImage.QueryComplete()); - CleanupStack::PopAndDestroy(&contextImage); - CleanupStack::PopAndDestroy(&handlesImage); + HandleObjectHandlesUnderMacL(*iHandles); } else { + RMTPObjectMgrQueryContext context; + RArray handles; + CleanupClosePushL(context); + CleanupClosePushL(handles); TMTPObjectMgrQueryParams params(Request().Uint32(TMTPTypeRequest::ERequestParameter1), Request().Uint32(TMTPTypeRequest::ERequestParameter2), Request().Uint32(TMTPTypeRequest::ERequestParameter3)); do { @@ -185,7 +148,7 @@ if ( index != KErrNotFound ) { handles.Remove(index); - handles.Insert(handle,0); + handles.InsertL(handle,0); } } delete StorageSuid; @@ -194,13 +157,11 @@ } iHandles->AppendL(handles); } - while (!context.QueryComplete()); + while (!context.QueryComplete()); + CleanupStack::PopAndDestroy(&handles); + CleanupStack::PopAndDestroy(&context); } - - - - CleanupStack::PopAndDestroy(&handles); - CleanupStack::PopAndDestroy(&context); + SendDataL(*iHandles); __FLOG(_L8("ServiceL - Exit")); } diff -r 883e91c086aa -r 48c22c726cf9 mtpfws/mtpfw/dataproviders/devdp/src/cmtpgetstorageinfo.cpp --- a/mtpfws/mtpfw/dataproviders/devdp/src/cmtpgetstorageinfo.cpp Tue Jul 06 15:13:34 2010 +0300 +++ b/mtpfws/mtpfw/dataproviders/devdp/src/cmtpgetstorageinfo.cpp Wed Aug 18 10:38:51 2010 +0300 @@ -26,10 +26,7 @@ #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" +#include "mtpcommonconst.h" // Class constants. __FLOG_STMT(_LIT8(KComponent,"GetStorageInfo");) @@ -199,7 +196,7 @@ { //E: is set as logically removable after eMMC image updated //So here we need to deal with this case to set it as FixedRam - if(iDriveInfo.iDriveAtt & KDriveAttInternal) + if(iDriveInfo.iDriveAtt & KDriveAttLogicallyRemovable) { __FLOG(_L8("removable but internal drive, set as Fixed RAM")); storageType = EMTPStorageFixedRAM; diff -r 883e91c086aa -r 48c22c726cf9 mtpfws/mtpfw/dataproviders/devdp/src/cmtptypedeviceinfo.cpp --- a/mtpfws/mtpfw/dataproviders/devdp/src/cmtptypedeviceinfo.cpp Tue Jul 06 15:13:34 2010 +0300 +++ b/mtpfws/mtpfw/dataproviders/devdp/src/cmtptypedeviceinfo.cpp Wed Aug 18 10:38:51 2010 +0300 @@ -130,7 +130,9 @@ } __ASSERT_DEBUG(chunk, User::Invariant()); + CleanupStack::PushL(chunk); ChunkAppendL(*chunk); + CleanupStack::Pop(chunk); } } } diff -r 883e91c086aa -r 48c22c726cf9 mtpfws/mtpfw/dataproviders/dputility/src/cmtpfsenumerator.cpp --- a/mtpfws/mtpfw/dataproviders/dputility/src/cmtpfsenumerator.cpp Tue Jul 06 15:13:34 2010 +0300 +++ b/mtpfws/mtpfw/dataproviders/dputility/src/cmtpfsenumerator.cpp Wed Aug 18 10:38:51 2010 +0300 @@ -122,7 +122,7 @@ const TUint KCount(storages.Count()); for (TUint i(0); (i < KCount); i++) { - iStorages.Insert(storages[i]->Uint(CMTPStorageMetaData::EStorageId),0); + iStorages.InsertL(storages[i]->Uint(CMTPStorageMetaData::EStorageId),0); __FLOG_VA((_L8("FileEnumerator is doing storage id = %x\r\n"), storages[i]->Uint(CMTPStorageMetaData::EStorageId) )); } CleanupStack::PopAndDestroy(&storages); @@ -396,18 +396,27 @@ TInt CMTPFSEnumerator::RunError(TInt aError) { __FLOG_VA((_L8("RunError - entry with error %d"), aError)); - if(!iFramework.StorageMgr().ValidStorageId(iStorages[iScanPos])) - { - __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. - //Then need to start from root dir of next storage if there is. - //So, the dir stack is popped to bottom. - iDirStack.Reset(); - } - iSkipCurrentStorage = ETrue; - } + + // avoid to access overflow of iStorages + if (iScanPos < iStorages.Count()) + { + if(!iFramework.StorageMgr().ValidStorageId(iStorages[iScanPos])) + { + __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. + //Then need to start from root dir of next storage if there is. + //So, the dir stack is popped to bottom. + iDirStack.Reset(); + } + iSkipCurrentStorage = ETrue; + } + } + else + { + iSkipCurrentStorage = ETrue; + } // Reschedule ourselves TRequestStatus* status = &iStatus; @@ -501,7 +510,7 @@ ++len; format = EMTPFormatCodeAssociation; AddEntryL(iCurrentPath, handle, format, KMTPDeviceDPID, entry, iStorages[iScanPos], iParentHandle); - iDirStack.Append(TStackItem(iCurrentPath, handle)); + iDirStack.AppendL(TStackItem(iCurrentPath, handle)); } } else @@ -548,10 +557,16 @@ __FLOG_VA((_L("mime %S"), mime)); DpId = iDpSingletons.MTPUtility().GetDpIdL(parse.Ext().Mid(1),*mime); __FLOG_VA((_L("DpId find %d"), DpId)); + + 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)); } - 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)); + else + { + AddEntryL(iCurrentPath, handle, EMTPFormatCodeUndefined, iDpID, entry, iStorages[iScanPos], iParentHandle); + } + CleanupStack::PopAndDestroy(mime); } else diff -r 883e91c086aa -r 48c22c726cf9 mtpfws/mtpfw/dataproviders/dputility/src/cmtpgetformatcapabilities.cpp --- a/mtpfws/mtpfw/dataproviders/dputility/src/cmtpgetformatcapabilities.cpp Tue Jul 06 15:13:34 2010 +0300 +++ b/mtpfws/mtpfw/dataproviders/dputility/src/cmtpgetformatcapabilities.cpp Wed Aug 18 10:38:51 2010 +0300 @@ -95,44 +95,71 @@ CMTPTypeFormatCapability* frmCap = CMTPTypeFormatCapability::NewLC( EMTPFormatCodeAssociation ,interDesc ); //EMTPObjectPropCodeStorageID - frmCap->AppendL( CMTPTypeObjectPropDesc::NewL(EMTPObjectPropCodeStorageID) ); + CMTPTypeObjectPropDesc* storageId = CMTPTypeObjectPropDesc::NewLC(EMTPObjectPropCodeStorageID); + frmCap->AppendL(storageId); + CleanupStack::Pop(storageId); //EMTPObjectPropCodeObjectFormat - frmCap->AppendL( CMTPTypeObjectPropDesc::NewL(EMTPObjectPropCodeObjectFormat) ); + CMTPTypeObjectPropDesc* objFormat = CMTPTypeObjectPropDesc::NewLC(EMTPObjectPropCodeObjectFormat); + frmCap->AppendL(objFormat); + CleanupStack::Pop(objFormat); //EMTPObjectPropCodeProtectionStatus - frmCap->AppendL( ServiceProtectionStatusL() ); + CMTPTypeObjectPropDesc* protectionStatus = ServiceProtectionStatusL(); + CleanupStack::PushL(protectionStatus); + frmCap->AppendL(protectionStatus); + CleanupStack::Pop(protectionStatus); //EMTPObjectPropCodeAssociationType - frmCap->AppendL( ServiceAssociationTypeL() ); + CMTPTypeObjectPropDesc* associationType = ServiceAssociationTypeL(); + CleanupStack::PushL(associationType); + frmCap->AppendL(associationType); + CleanupStack::Pop(associationType); //EMTPObjectPropCodeAssociationDesc - frmCap->AppendL( CMTPTypeObjectPropDesc::NewL(EMTPObjectPropCodeAssociationDesc) ); + CMTPTypeObjectPropDesc* associationDesc = CMTPTypeObjectPropDesc::NewLC(EMTPObjectPropCodeAssociationDesc); + frmCap->AppendL(associationDesc); + CleanupStack::Pop(associationDesc); //EMTPObjectPropCodeObjectSize - frmCap->AppendL( CMTPTypeObjectPropDesc::NewL(EMTPObjectPropCodeObjectSize) ); + CMTPTypeObjectPropDesc* objSize = CMTPTypeObjectPropDesc::NewLC(EMTPObjectPropCodeObjectSize); + frmCap->AppendL(objSize); + CleanupStack::Pop(objSize); //EMTPObjectPropCodeObjectFileName _LIT(KMtpObjDescObjFileName, "[a-zA-Z!#\\$%&'\\(\\)\\-0-9@\\^_\\`\\{\\}\\~][a-zA-Z!#\\$%&'\\(\\)\\-0-9@\\^_\\`\\{\\}\\~ ]{0, 7}\\.[[a-zA-Z!#\\$%&'\\(\\)\\-0-9@\\^_\\`\\{\\}\\~][a-zA-Z!#\\$%&'\\(\\)\\-0-9@\\^_\\`\\{\\}\\~ ]{0, 2}]?"); - CMTPTypeString* form = CMTPTypeString::NewLC( KMtpObjDescObjFileName ); - frmCap->AppendL(CMTPTypeObjectPropDesc::NewL( EMTPObjectPropCodeObjectFileName, - CMTPTypeObjectPropDesc::ERegularExpressionForm, form)); + CMTPTypeString* form = CMTPTypeString::NewLC( KMtpObjDescObjFileName ); + CMTPTypeObjectPropDesc* objFileName = CMTPTypeObjectPropDesc::NewLC( EMTPObjectPropCodeObjectFileName, + CMTPTypeObjectPropDesc::ERegularExpressionForm, form); + frmCap->AppendL(objFileName); + CleanupStack::Pop(objFileName); CleanupStack::PopAndDestroy(form ); //EMTPObjectPropCodeDateModified - frmCap->AppendL( CMTPTypeObjectPropDesc::NewL(EMTPObjectPropCodeDateModified) ); + CMTPTypeObjectPropDesc* dateModified = CMTPTypeObjectPropDesc::NewLC(EMTPObjectPropCodeDateModified); + frmCap->AppendL(dateModified); + CleanupStack::Pop(dateModified); //EMTPObjectPropCodeParentObject - frmCap->AppendL( CMTPTypeObjectPropDesc::NewL(EMTPObjectPropCodeParentObject) ); + CMTPTypeObjectPropDesc* parentobj = CMTPTypeObjectPropDesc::NewLC(EMTPObjectPropCodeParentObject); + frmCap->AppendL(parentobj); + CleanupStack::Pop(parentobj); //EMTPObjectPropCodePersistentUniqueObjectIdentifier - frmCap->AppendL( CMTPTypeObjectPropDesc::NewL(EMTPObjectPropCodePersistentUniqueObjectIdentifier) ); + CMTPTypeObjectPropDesc* objectIdentifier = CMTPTypeObjectPropDesc::NewLC(EMTPObjectPropCodePersistentUniqueObjectIdentifier); + frmCap->AppendL(objectIdentifier); + CleanupStack::Pop(objectIdentifier); //EMTPObjectPropCodeName - frmCap->AppendL( CMTPTypeObjectPropDesc::NewL(EMTPObjectPropCodeName)); + CMTPTypeObjectPropDesc* name = CMTPTypeObjectPropDesc::NewLC(EMTPObjectPropCodeName); + frmCap->AppendL(name); + CleanupStack::Pop(name); //EMTPObjectPropCodeNonConsumable - frmCap->AppendL(ServiceNonConsumableL() ); + CMTPTypeObjectPropDesc* nonConsumable = ServiceNonConsumableL(); + CleanupStack::PushL(nonConsumable); + frmCap->AppendL(nonConsumable); + CleanupStack::Pop(nonConsumable); iCapabilityList->AppendL(frmCap); CleanupStack::Pop(frmCap); @@ -146,38 +173,60 @@ CMTPTypeFormatCapability* frmCap = CMTPTypeFormatCapability::NewLC( aFormatCode ,interDesc ); //EMTPObjectPropCodeStorageID - frmCap->AppendL( CMTPTypeObjectPropDesc::NewL(EMTPObjectPropCodeStorageID) ); + CMTPTypeObjectPropDesc* storageID = CMTPTypeObjectPropDesc::NewLC(EMTPObjectPropCodeStorageID); + frmCap->AppendL(storageID); + CleanupStack::Pop(storageID); //EMTPObjectPropCodeObjectFormat - frmCap->AppendL( CMTPTypeObjectPropDesc::NewL(EMTPObjectPropCodeObjectFormat) ); + CMTPTypeObjectPropDesc* objectFormat = CMTPTypeObjectPropDesc::NewLC(EMTPObjectPropCodeObjectFormat); + frmCap->AppendL(objectFormat); + CleanupStack::Pop(objectFormat); //EMTPObjectPropCodeProtectionStatus - frmCap->AppendL( ServiceProtectionStatusL() ); + CMTPTypeObjectPropDesc* protectionStatus = ServiceProtectionStatusL(); + CleanupStack::PushL(protectionStatus); + frmCap->AppendL(protectionStatus); + CleanupStack::Pop(protectionStatus); //EMTPObjectPropCodeObjectSize - frmCap->AppendL( CMTPTypeObjectPropDesc::NewL(EMTPObjectPropCodeObjectSize) ); + CMTPTypeObjectPropDesc* objSize = CMTPTypeObjectPropDesc::NewLC(EMTPObjectPropCodeObjectSize); + frmCap->AppendL(objSize); + CleanupStack::Pop(objSize); //EMTPObjectPropCodeObjectFileName _LIT(KMtpObjDescObjFileName, "[a-zA-Z!#\\$%&'\\(\\)\\-0-9@\\^_\\`\\{\\}\\~][a-zA-Z!#\\$%&'\\(\\)\\-0-9@\\^_\\`\\{\\}\\~ ]{0, 7}\\.[[a-zA-Z!#\\$%&'\\(\\)\\-0-9@\\^_\\`\\{\\}\\~][a-zA-Z!#\\$%&'\\(\\)\\-0-9@\\^_\\`\\{\\}\\~ ]{0, 2}]?"); - CMTPTypeString* form = CMTPTypeString::NewLC( KMtpObjDescObjFileName ); - frmCap->AppendL(CMTPTypeObjectPropDesc::NewL( EMTPObjectPropCodeObjectFileName, - CMTPTypeObjectPropDesc::ERegularExpressionForm, form)); + CMTPTypeString* form = CMTPTypeString::NewLC( KMtpObjDescObjFileName ); + CMTPTypeObjectPropDesc* objFileName = CMTPTypeObjectPropDesc::NewLC( EMTPObjectPropCodeObjectFileName, + CMTPTypeObjectPropDesc::ERegularExpressionForm, form); + frmCap->AppendL(objFileName); + CleanupStack::Pop(objFileName); CleanupStack::PopAndDestroy(form ); //EMTPObjectPropCodeDateModified - frmCap->AppendL( CMTPTypeObjectPropDesc::NewL(EMTPObjectPropCodeDateModified) ); + CMTPTypeObjectPropDesc* dateModified = CMTPTypeObjectPropDesc::NewLC(EMTPObjectPropCodeDateModified); + frmCap->AppendL(dateModified); + CleanupStack::Pop(dateModified); //EMTPObjectPropCodeParentObject - frmCap->AppendL( CMTPTypeObjectPropDesc::NewL(EMTPObjectPropCodeParentObject) ); + CMTPTypeObjectPropDesc* parentObject = CMTPTypeObjectPropDesc::NewLC(EMTPObjectPropCodeParentObject); + frmCap->AppendL(parentObject); + CleanupStack::Pop(parentObject); //EMTPObjectPropCodePersistentUniqueObjectIdentifier - frmCap->AppendL( CMTPTypeObjectPropDesc::NewL(EMTPObjectPropCodePersistentUniqueObjectIdentifier) ); + CMTPTypeObjectPropDesc* objectIdentifier = CMTPTypeObjectPropDesc::NewLC(EMTPObjectPropCodePersistentUniqueObjectIdentifier); + frmCap->AppendL(objectIdentifier); + CleanupStack::Pop(objectIdentifier); //EMTPObjectPropCodeName - frmCap->AppendL( CMTPTypeObjectPropDesc::NewL(EMTPObjectPropCodeName)); + CMTPTypeObjectPropDesc* name = CMTPTypeObjectPropDesc::NewLC(EMTPObjectPropCodeName); + frmCap->AppendL(name); + CleanupStack::Pop(name); //EMTPObjectPropCodeNonConsumable - frmCap->AppendL(ServiceNonConsumableL() ); + CMTPTypeObjectPropDesc* nonConsumable = ServiceNonConsumableL(); + CleanupStack::PushL(nonConsumable); + frmCap->AppendL(nonConsumable); + CleanupStack::Pop(nonConsumable); iCapabilityList->AppendL(frmCap); CleanupStack::Pop(frmCap); diff -r 883e91c086aa -r 48c22c726cf9 mtpfws/mtpfw/dataproviders/dputility/src/cmtpknowledgehandler.cpp --- a/mtpfws/mtpfw/dataproviders/dputility/src/cmtpknowledgehandler.cpp Tue Jul 06 15:13:34 2010 +0300 +++ b/mtpfws/mtpfw/dataproviders/dputility/src/cmtpknowledgehandler.cpp Wed Aug 18 10:38:51 2010 +0300 @@ -747,7 +747,7 @@ TInt count = sizeof(KMTPFullEnumSyncKnowledgeObjectProperties) / sizeof(KMTPFullEnumSyncKnowledgeObjectProperties[0]); for (TInt i = 0; i < count; i++) { - aPropCodes.Append(KMTPFullEnumSyncKnowledgeObjectProperties[i]); + aPropCodes.AppendL(KMTPFullEnumSyncKnowledgeObjectProperties[i]); } } else if(2 == aGroupId) diff -r 883e91c086aa -r 48c22c726cf9 mtpfws/mtpfw/dataproviders/dputility/src/cmtpmoveobject.cpp --- a/mtpfws/mtpfw/dataproviders/dputility/src/cmtpmoveobject.cpp Tue Jul 06 15:13:34 2010 +0300 +++ b/mtpfws/mtpfw/dataproviders/dputility/src/cmtpmoveobject.cpp Wed Aug 18 10:38:51 2010 +0300 @@ -36,7 +36,7 @@ */ const TMTPRequestElementInfo KMTPMoveObjectPolicy[] = { - {TMTPTypeRequest::ERequestParameter1, EMTPElementTypeObjectHandle, EMTPElementAttrFileOrDir | EMTPElementAttrWrite, 0, 0, 0}, + {TMTPTypeRequest::ERequestParameter1, EMTPElementTypeObjectHandle, EMTPElementAttrFileOrDir, 0, 0, 0}, {TMTPTypeRequest::ERequestParameter2, EMTPElementTypeStorageId, EMTPElementAttrWrite, 0, 0, 0}, {TMTPTypeRequest::ERequestParameter3, EMTPElementTypeObjectHandle, EMTPElementAttrDir, 1, 0, 0} }; diff -r 883e91c086aa -r 48c22c726cf9 mtpfws/mtpfw/dataproviders/dputility/src/cmtpsendobjectinfo.cpp --- a/mtpfws/mtpfw/dataproviders/dputility/src/cmtpsendobjectinfo.cpp Tue Jul 06 15:13:34 2010 +0300 +++ b/mtpfws/mtpfw/dataproviders/dputility/src/cmtpsendobjectinfo.cpp Wed Aug 18 10:38:51 2010 +0300 @@ -540,7 +540,7 @@ } } - if (result) + if (result && !iIsFolder) { result &= !Exists(iFullPath); if (!result) @@ -613,7 +613,7 @@ } } - if (result) + if (result && !iIsFolder) { result = !Exists(iFullPath); if (!result) @@ -1100,18 +1100,28 @@ iReceivedObject->SetUint(CMTPObjectMetaData::EStorageId, iStorageId); iReceivedObject->SetDesCL(CMTPObjectMetaData::ESuid, iFullPath); - iFramework.ObjectMgr().ReserveObjectHandleL(*iReceivedObject, iObjectSize); - if(iIsFolder) { - SetPropertiesL(); - iFramework.ObjectMgr().CommitReservedObjectHandleL(*iReceivedObject); + SetPropertiesL(); + TUint32 handle = iFramework.ObjectMgr().HandleL(iFullPath); + if (handle != KMTPHandleNone) + { + // The folder is already in DB + iReceivedObject->SetUint(CMTPObjectMetaData::EHandle, handle); + iFramework.ObjectMgr().ModifyObjectL(*iReceivedObject); + } + else + { + iFramework.ObjectMgr().ReserveObjectHandleL(*iReceivedObject, iObjectSize); + iFramework.ObjectMgr().CommitReservedObjectHandleL(*iReceivedObject); + } } else - { - iExpectedSendObjectRequest.SetUint32(TMTPTypeRequest::ERequestSessionID, iSessionId); - iFramework.RouteRequestRegisterL(iExpectedSendObjectRequest, iConnection); - } + { + iFramework.ObjectMgr().ReserveObjectHandleL(*iReceivedObject, iObjectSize); + iExpectedSendObjectRequest.SetUint32(TMTPTypeRequest::ERequestSessionID, iSessionId); + iFramework.RouteRequestRegisterL(iExpectedSendObjectRequest, iConnection); + } TUint32 parameters[3]; parameters[0] = iStorageId; parameters[1] = iParentHandle; @@ -1124,7 +1134,10 @@ { if (iIsFolder) { - User::LeaveIfError(iFramework.Fs().MkDirAll(iFullPath)); + if (!Exists(iFullPath)) + { + User::LeaveIfError(iFramework.Fs().MkDirAll(iFullPath)); + } } else { diff -r 883e91c086aa -r 48c22c726cf9 mtpfws/mtpfw/dataproviders/dputility/src/rmtputility.cpp --- a/mtpfws/mtpfw/dataproviders/dputility/src/rmtputility.cpp Tue Jul 06 15:13:34 2010 +0300 +++ b/mtpfws/mtpfw/dataproviders/dputility/src/rmtputility.cpp Wed Aug 18 10:38:51 2010 +0300 @@ -526,6 +526,7 @@ if (KErrNone != iFramework->Fs().Entry(entryName, entry)) { // Skip objects that don't use the file path as SUID. + CleanupStack::PopAndDestroy(&rightPartName); CleanupStack::PopAndDestroy(&entryName); continue; } diff -r 883e91c086aa -r 48c22c726cf9 mtpfws/mtpfw/dataproviders/proxydp/src/cmtpdeleteobjectproplist.cpp --- a/mtpfws/mtpfw/dataproviders/proxydp/src/cmtpdeleteobjectproplist.cpp Tue Jul 06 15:13:34 2010 +0300 +++ b/mtpfws/mtpfw/dataproviders/proxydp/src/cmtpdeleteobjectproplist.cpp Wed Aug 18 10:38:51 2010 +0300 @@ -148,7 +148,7 @@ dpid = iSingletons.ObjectMgr().ObjectOwnerId( temp.Uint32(TMTPTypeDataPair::EOwnerHandle) ); if ( tmpDpid != dpid ) { - iTargetDps.Append(dpid); + iTargetDps.AppendL(dpid); CMTPTypeDeleteObjectPropList* dataset = CMTPTypeDeleteObjectPropList::NewLC(); iSubDatasets.AppendL( dataset ); dataset->AppendL( element); diff -r 883e91c086aa -r 48c22c726cf9 mtpfws/mtpfw/datatypes/group/mtpdatatypes.mmp --- a/mtpfws/mtpfw/datatypes/group/mtpdatatypes.mmp Tue Jul 06 15:13:34 2010 +0300 +++ b/mtpfws/mtpfw/datatypes/group/mtpdatatypes.mmp Wed Aug 18 10:38:51 2010 +0300 @@ -37,8 +37,8 @@ MW_LAYER_SYSTEMINCLUDE_SYMBIAN USERINCLUDE ../inc -//For UiklafInternalCRKeys.h,should be removed, after we switched to DFs -USERINCLUDE ../../common/inc +USERINCLUDE ../../inc + SOURCEPATH ../src diff -r 883e91c086aa -r 48c22c726cf9 mtpfws/mtpfw/datatypes/interface/mtpprotocolconstants.h --- a/mtpfws/mtpfw/datatypes/interface/mtpprotocolconstants.h Tue Jul 06 15:13:34 2010 +0300 +++ b/mtpfws/mtpfw/datatypes/interface/mtpprotocolconstants.h Wed Aug 18 10:38:51 2010 +0300 @@ -368,7 +368,7 @@ EMTPRespCodeCaptureAlreadyTerminated = 0x2018, EMTPRespCodeDeviceBusy = 0x2019, EMTPRespCodeInvalidParentObject = 0x201A, - EMTPRespCodeInvalidDeviEMTPRespCodecePropFormat = 0x201B, + EMTPRespCodeInvalidDevicePropFormat = 0x201B, EMTPRespCodeInvalidDevicePropValue = 0x201C, EMTPRespCodeInvalidParameter = 0x201D, EMTPRespCodeSessionAlreadyOpen = 0x201E, diff -r 883e91c086aa -r 48c22c726cf9 mtpfws/mtpfw/datatypes/src/cmtptypefile.cpp --- a/mtpfws/mtpfw/datatypes/src/cmtptypefile.cpp Tue Jul 06 15:13:34 2010 +0300 +++ b/mtpfws/mtpfw/datatypes/src/cmtptypefile.cpp Wed Aug 18 10:38:51 2010 +0300 @@ -21,9 +21,7 @@ #include #include -//This file is exported from s60 sdk, now just copy it -//to make sure onb can run -#include "UiklafInternalCRKeys.h" +#include "mtpcommonconst.h" // File type constants. const TInt KMTPFileChunkSizeForLargeFile(0x00080000); // 512K diff -r 883e91c086aa -r 48c22c726cf9 mtpfws/mtpfw/datatypes/src/cmtptypeobjectinfo.cpp --- a/mtpfws/mtpfw/datatypes/src/cmtptypeobjectinfo.cpp Tue Jul 06 15:13:34 2010 +0300 +++ b/mtpfws/mtpfw/datatypes/src/cmtptypeobjectinfo.cpp Wed Aug 18 10:38:51 2010 +0300 @@ -128,7 +128,9 @@ } __ASSERT_DEBUG(chunk, User::Invariant()); + CleanupStack::PushL(chunk); ChunkAppendL(*chunk); + CleanupStack::Pop(chunk); } } } diff -r 883e91c086aa -r 48c22c726cf9 mtpfws/mtpfw/datatypes/src/cmtptypestorageinfo.cpp --- a/mtpfws/mtpfw/datatypes/src/cmtptypestorageinfo.cpp Tue Jul 06 15:13:34 2010 +0300 +++ b/mtpfws/mtpfw/datatypes/src/cmtptypestorageinfo.cpp Wed Aug 18 10:38:51 2010 +0300 @@ -115,7 +115,9 @@ break; } __ASSERT_DEBUG(chunk, User::Invariant()); + CleanupStack::PushL(chunk); ChunkAppendL(*chunk); + CleanupStack::Pop(chunk); } } } diff -r 883e91c086aa -r 48c22c726cf9 mtpfws/mtpfw/inc/cmtpconnection.h --- a/mtpfws/mtpfw/inc/cmtpconnection.h Tue Jul 06 15:13:34 2010 +0300 +++ b/mtpfws/mtpfw/inc/cmtpconnection.h Wed Aug 18 10:38:51 2010 +0300 @@ -147,6 +147,7 @@ void EnqueueEvent(CMTPEventLink* aLink); void DequeueEvent(CMTPEventLink* aLink); + void DequeueAllEvents(); /** * This method define and attach the property for publishing connection state diff -r 883e91c086aa -r 48c22c726cf9 mtpfws/mtpfw/inc/mtpcommonconst.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mtpfws/mtpfw/inc/mtpcommonconst.h Wed Aug 18 10:38:51 2010 +0300 @@ -0,0 +1,53 @@ +// 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 + @internalComponent +*/ + +#ifndef MTPCOMMONCONST_H +#define MTPCOMMONCONST_H + +#ifdef __SERIES60_ +#include +#else +//Following is copied from 'UiklafInternalCRKeys.h', which is +//exported from S60 sdk, in Symbian CBR, this file does not exist. +const TUid KCRUidUiklaf = { 0x101F8774 }; +const TUint32 KUikOODDiskFreeSpaceWarningNoteLevel = 0x00000006; +const TUint32 KUikOODDiskFreeSpaceWarningNoteLevelMassMemory = 0x00000007; +#endif + +#ifdef __MTP_NAVIENGINE_TEST +//The free size of C-Drive of NaviEngine env is less than 21M, +//it will block many ONB test cases +const TInt KFreeSpaceThreshHoldDefaultValue(0); +const TInt KFreeSpaceExtraReserved(0); + +#else +//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,Thumbnail manager to store their data, set this as 7M +const TInt KFreeSpaceExtraReserved(7*1024*1024);//7M bytes + +#endif +#endif //MTPCOMMONCONST_H diff -r 883e91c086aa -r 48c22c726cf9 mtpfws/mtpfw/src/cmtpconnection.cpp --- a/mtpfws/mtpfw/src/cmtpconnection.cpp Tue Jul 06 15:13:34 2010 +0300 +++ b/mtpfws/mtpfw/src/cmtpconnection.cpp Wed Aug 18 10:38:51 2010 +0300 @@ -82,18 +82,16 @@ __FLOG(_L8("~CMTPConnection - Entry")); CloseAllSessions(); - // Remove any events not associated - // with a session - TSglQueIter iter(iEventQ); - iter.SetToFirst(); - CMTPEventLink* link = NULL; + //remove all events + DequeueAllEvents(); + + iSessions.ResetAndDestroy(); - while ((link = iter++) != NULL) - { - delete link; - } + if (iTransportConnection != NULL) + { + iTransportConnection->Unbind(*this); + } - iSessions.ResetAndDestroy(); //close the property iProperty.Close(); // delete the ‘name?property @@ -357,7 +355,7 @@ CompleteCloseConnection(); ret = ETrue; } - + SetState(EStateShutdown); PublishConnState(EDisconnectedFromHost); } @@ -372,10 +370,6 @@ CloseAllSessions(); iSessions.Reset(); - if (iTransportConnection != NULL) - { - iTransportConnection->Unbind(*this); - } //notify ConnectionMgr and corresponding transports of completion of connection close iSingletons.ConnectionMgr().ConnectionCloseComplete(iConnectionId); @@ -405,8 +399,12 @@ */ SessionOpenedL(KMTPSessionNone); + if (iTransportConnection != NULL) + { + iTransportConnection->Unbind(*this); + } iTransportConnection = &aTransportConnection; - iTransportConnection->BindL(*this); + iTransportConnection->BindL(*this); SetState(EStateOpen); } @@ -661,9 +659,16 @@ DequeueEvent(iEventQ.First()); if (iPendingEventCount > 0) { - // Forward the event to the transport connection layer. - __FLOG(_L8("Sending queued event")); - iTransportConnection->SendEventL(iEventQ.First()->iEvent); + if (NULL != iTransportConnection) + { + // Forward the event to the transport connection layer. + __FLOG(_L8("Sending queued event")); + iTransportConnection->SendEventL(iEventQ.First()->iEvent); + } + else + { + DequeueAllEvents(); + } } __FLOG(_L8("SendEventCompleteL - Exit")); @@ -707,7 +712,7 @@ iEventQ(_FOFF(CMTPEventLink, iLink)), iTransportConnection(&aTransportConnection) { - + iTransportConnection->BindL(*this); } /** @@ -1040,6 +1045,19 @@ __FLOG(_L8("RemoveEventsForSession - Exit")); } +void CMTPConnection::DequeueAllEvents() + { + TSglQueIter iter(iEventQ); + iter.SetToFirst(); + CMTPEventLink* link = NULL; + + while ((link = iter++) != NULL) + { + delete link; + } + iPendingEventCount = 0; + } + void CMTPConnection::DequeueEvent(CMTPEventLink* aLink) { iEventQ.Remove(*aLink); diff -r 883e91c086aa -r 48c22c726cf9 mtpfws/mtpfw/src/cmtpconnectionmgr.cpp --- a/mtpfws/mtpfw/src/cmtpconnectionmgr.cpp Tue Jul 06 15:13:34 2010 +0300 +++ b/mtpfws/mtpfw/src/cmtpconnectionmgr.cpp Wed Aug 18 10:38:51 2010 +0300 @@ -13,8 +13,6 @@ // Description: // -#include -#include #include "cmtpconnectionmgr.h" #include "cmtpconnection.h" @@ -115,33 +113,6 @@ EXPORT_C void CMTPConnectionMgr::StartTransportL(TUid aTransport) { __FLOG(_L8("StartTransportL - Entry")); - - RUsb usb; - User::LeaveIfError(usb.Connect()); - __FLOG(_L8("after connect, and before call get currentpersonalityid")); - TInt usbMode; - TUsbServiceState usbStat; - TInt err = usb.GetCurrentPersonalityId(usbMode); - __FLOG_1(_L8("The return value of GetCurrentPersonalityId is %d"), err); - - err = usb.GetServiceState(usbStat); - __FLOG_1(_L8("The return value of GetServiceState is %d"), err); - - usb.Close(); - - __FLOG_1(_L8("The current usb mode is %d"), usbMode); - __FLOG_1(_L8("The current usb service state is %d"), usbStat); - - TInt massStorageMode = 0x02; - - if(usbMode == massStorageMode && usbStat != EUsbServiceIdle) - { - __FLOG(_L8("StartTransportL without parameter!")); - StartTransportL( aTransport, NULL ); - return; - } - - //When USB plug out, BT will start Master mode to reconnect remote device. Else BT will start slave mode to listen connection. if(aTransport.iUid == KMTPBTTransportUid && iRemoteDevice.iDeviceAddr != 0 && aTransport != iTransportUid) diff -r 883e91c086aa -r 48c22c726cf9 mtpfws/mtpfw/src/cmtpdataprovidercontroller.cpp --- a/mtpfws/mtpfw/src/cmtpdataprovidercontroller.cpp Tue Jul 06 15:13:34 2010 +0300 +++ b/mtpfws/mtpfw/src/cmtpdataprovidercontroller.cpp Wed Aug 18 10:38:51 2010 +0300 @@ -185,7 +185,7 @@ if ((iDataProviders[index]->DataProviderId() != iDpIdDeviceDp) && (iDataProviders[index]->DataProviderId() != iDpIdProxyDp)) { - iDataProviderIds.Append(iDataProviders[index]->DataProviderId()); + iDataProviderIds.AppendL(iDataProviders[index]->DataProviderId()); } } @@ -484,7 +484,7 @@ Cancel(); //clean the root level snapshot - iSingletons.ObjectMgr().ObjectStore().CleanDBSnapshotL(ETrue); + TRAP_IGNORE(iSingletons.ObjectMgr().ObjectStore().CleanDBSnapshotL(ETrue)); //Schedule again to scan subdir iEnumerationState = EEnumeratingSubDirFiles; @@ -500,9 +500,7 @@ { Cancel(); iEnumerationState = EEnumeratingCleanDBSnapshot; - iSingletons.ObjectMgr().ObjectStore().CleanDBSnapshotL(EFalse); - - + TRAP_IGNORE(iSingletons.ObjectMgr().ObjectStore().CleanDBSnapshotL(EFalse)); } else { diff -r 883e91c086aa -r 48c22c726cf9 mtpfws/mtpfw/src/cmtpobjectstore.cpp --- a/mtpfws/mtpfw/src/cmtpobjectstore.cpp Tue Jul 06 15:13:34 2010 +0300 +++ b/mtpfws/mtpfw/src/cmtpobjectstore.cpp Wed Aug 18 10:38:51 2010 +0300 @@ -442,6 +442,12 @@ TBool needUpdateOwner = EFalse; TUint dpId(aObject.Uint(CMTPObjectMetaData::EDataProviderId)); + if ((aObject.DesC(CMTPObjectMetaData::ESuid)).Length() > KMaxFileName) + { + // The length of object uid should not excceeds KMaxFileName + User::Leave( KErrBadName ); + } + TFileName suid; suid.CopyLC(aObject.DesC(CMTPObjectMetaData::ESuid)); TUint32 suidHash = DefaultHash::Des16(suid); @@ -478,7 +484,8 @@ aObject.SetUint(CMTPObjectMetaData::EHandle, handle); id = iEnumeratingCacheObjList[found]->iPOUID; aObject.SetUint(CMTPObjectMetaData::EIdentifier, id); - if(iEnumeratingCacheObjList[found]->iFormatcode != aObject.Uint(CMTPObjectMetaData::EFormatCode)) + if(iEnumeratingCacheObjList[found]->iFormatcode != aObject.Uint(CMTPObjectMetaData::EFormatCode) || + iEnumeratingCacheObjList[found]->iObjParentId != aObject.Uint(CMTPObjectMetaData::EParentHandle)) {//have different owner needUpdateOwner = ETrue; } @@ -523,6 +530,7 @@ 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 { TUint32 parentHandle(aObject.Uint(CMTPObjectMetaData::EParentHandle)); @@ -562,6 +570,7 @@ iBatched.SetColL(EObjectStoreModes, aObject.Uint(CMTPObjectMetaData::EModes)); iBatched.SetColL(EObjectStoreNonConsumable, aObject.Uint(CMTPObjectMetaData::ENonConsumable)); iBatched.SetColL(EObjectStoreName, aObject.DesC(CMTPObjectMetaData::EName)); + iBatched.SetColL(EObjectStoreParentHandle, aObject.Uint(CMTPObjectMetaData::EParentHandle)); iBatched.PutL(); CleanupStack::Pop(&iBatched); IncTranOpsNumL(); @@ -938,6 +947,14 @@ { err = iDatabase.Recover(); } + if(KErrNone == err) + { + err = iDatabase.Compact(); + if(KErrNone != err) + {//the DB file is corrupt + BaflUtils::DeleteFile(iSingletons.Fs(), fullName); + } + } } if (err != KErrNone) diff -r 883e91c086aa -r 48c22c726cf9 mtpfws/mtpfw/src/cmtpreferencemgr.cpp --- a/mtpfws/mtpfw/src/cmtpreferencemgr.cpp Tue Jul 06 15:13:34 2010 +0300 +++ b/mtpfws/mtpfw/src/cmtpreferencemgr.cpp Wed Aug 18 10:38:51 2010 +0300 @@ -136,7 +136,7 @@ for(TInt i = 0; i < count; i++) { TUint32 toHandle = iObjectStore.HandleL(aToSuids[i]); - toHandles.Append(toHandle); + toHandles.AppendL(toHandle); } SetReferencesL(fromHandle, toHandles); @@ -336,7 +336,7 @@ TInt count = aToHandles.NumElements(); for(TInt i = 0; i < count; i++) { - tempArray.Append(aToHandles.ElementUint(i)); + tempArray.AppendL(aToHandles.ElementUint(i)); } SetReferencesL(aFromHandle.Value(), tempArray); CleanupStack::PopAndDestroy(&tempArray); diff -r 883e91c086aa -r 48c22c726cf9 mtpfws/mtpfw/src/cmtpserviceconfig.cpp --- a/mtpfws/mtpfw/src/cmtpserviceconfig.cpp Tue Jul 06 15:13:34 2010 +0300 +++ b/mtpfws/mtpfw/src/cmtpserviceconfig.cpp Wed Aug 18 10:38:51 2010 +0300 @@ -237,7 +237,7 @@ TUint num = reader.ReadInt16(); while( num-- ) { - aNamespaces.Append( ReadGUID(reader) ); + aNamespaces.AppendL( ReadGUID(reader) ); } CleanupStack::PopAndDestroy(buffer); diff -r 883e91c086aa -r 48c22c726cf9 mtpfws/mtpfw/src/ruidmapper.cpp --- a/mtpfws/mtpfw/src/ruidmapper.cpp Tue Jul 06 15:13:34 2010 +0300 +++ b/mtpfws/mtpfw/src/ruidmapper.cpp Wed Aug 18 10:38:51 2010 +0300 @@ -50,7 +50,7 @@ for (TInt n = 0 ; n < entries; ++n) { TUint transportId(resourceReader.ReadInt32()); - st.iTransportUidList.Append(transportId); + st.iTransportUidList.AppendL(transportId); } InsertToMappingStruct(st); } diff -r 883e91c086aa -r 48c22c726cf9 mtptransports/mtpcontroller/src/cmtpbearermonitor.cpp --- a/mtptransports/mtpcontroller/src/cmtpbearermonitor.cpp Tue Jul 06 15:13:34 2010 +0300 +++ b/mtptransports/mtpcontroller/src/cmtpbearermonitor.cpp Wed Aug 18 10:38:51 2010 +0300 @@ -80,7 +80,9 @@ __FLOG( _L8("+ConstructL") ); CMTPBluetoothController* btController = CMTPBluetoothController::NewL( *this ); + CleanupStack::PushL(btController); iMTPControllers.AppendL( btController ); + CleanupStack::Pop(btController); __FLOG( _L8("-ConstructL") ); } diff -r 883e91c086aa -r 48c22c726cf9 mtptransports/mtpcontroller/src/cmtpcontrollertimer.cpp --- a/mtptransports/mtpcontroller/src/cmtpcontrollertimer.cpp Tue Jul 06 15:13:34 2010 +0300 +++ b/mtptransports/mtpcontroller/src/cmtpcontrollertimer.cpp Wed Aug 18 10:38:51 2010 +0300 @@ -89,7 +89,7 @@ { __FLOG( _L8("Start transport to launch mtp server") ); - iMTPClient.Connect(); + User::LeaveIfError(iMTPClient.Connect()); iMTPClient.StartTransport(KMTPBtTransportUid); iStopTransport = EFalse; iMTPOperator->SubscribeConnState(); diff -r 883e91c086aa -r 48c22c726cf9 mtptransports/mtpusbtransport/usbsic_imp/inc/cmtpusbepbase.h --- a/mtptransports/mtpusbtransport/usbsic_imp/inc/cmtpusbepbase.h Tue Jul 06 15:13:34 2010 +0300 +++ b/mtptransports/mtpusbtransport/usbsic_imp/inc/cmtpusbepbase.h Wed Aug 18 10:38:51 2010 +0300 @@ -55,6 +55,7 @@ void FlushRxDataL(); void FlushBufferedRxDataL(); + void FlushOnePacketL(); protected: diff -r 883e91c086aa -r 48c22c726cf9 mtptransports/mtpusbtransport/usbsic_imp/src/cmtpusbconnection.cpp --- a/mtptransports/mtpusbtransport/usbsic_imp/src/cmtpusbconnection.cpp Tue Jul 06 15:13:34 2010 +0300 +++ b/mtptransports/mtpusbtransport/usbsic_imp/src/cmtpusbconnection.cpp Wed Aug 18 10:38:51 2010 +0300 @@ -636,7 +636,11 @@ { __FLOG(_L8("SendInterruptDataCompleteL - Entry")); iEventPending = EFalse; + + if ( NULL != iProtocolLayer) + { BoundProtocolLayer().SendEventCompleteL(aError, iMTPEvent); + } __FLOG(_L8("SendInterruptDataCompleteL - Exit")); } @@ -1358,7 +1362,17 @@ { // Invalid bulk transaction state, close the connection. __FLOG_VA((_L8("Expected bulk transaction state = %d"), aExpectedTransactionState)); + + //if transaction is in request phase, while the container type of data we received is other transaction phase, + //just ignore the data and initiate another request receiving. + if (ERequestPhase == iBulkTransactionState) + { + InitiateBulkRequestSequenceL(); + } + else + { CloseConnection(); + } } __FLOG(_L8("BulkRequestTransactionStateValid - Exit")); return valid; @@ -1503,6 +1517,7 @@ __FLOG(_L8("BulkEndpointsStallL - Entry")); EndpointStallL(EMTPUsbEpBulkIn); EndpointStallL(EMTPUsbEpBulkOut); + SetDeviceStatus(EMTPUsbDeviceStatusTransactionCancelled); __FLOG(_L8("BulkEndpointsStallL - Exit")); } @@ -1669,6 +1684,7 @@ SetBulkTransactionState(EUndefined); SetConnectionState(EIdle); SetSuspendState(ENotSuspended); + iMTPSessionId = KMTPSessionNone; } __FLOG(_L8("StopConnection - Exit")); diff -r 883e91c086aa -r 48c22c726cf9 mtptransports/mtpusbtransport/usbsic_imp/src/cmtpusbepbase.cpp --- a/mtptransports/mtpusbtransport/usbsic_imp/src/cmtpusbepbase.cpp Tue Jul 06 15:13:34 2010 +0300 +++ b/mtptransports/mtpusbtransport/usbsic_imp/src/cmtpusbepbase.cpp Wed Aug 18 10:38:51 2010 +0300 @@ -596,19 +596,11 @@ // USB Header validation if (!ValidateUSBHeaderL()) { - //trash data, continue to flush. - TRequestStatus status; - RBuf8 readBuf; - readBuf.CreateL(KMaxPacketTypeBulkHS); - Connection().Ldd().ReadPacket(status, EndpointNumber(), readBuf, KMaxPacketTypeBulkHS); - User::WaitForRequest(status); - RDebug::Print(_L("CMTPUsbEpBase::ProcessFirstReceivedChunkL(), trash data length = %d"), readBuf.Length()); - readBuf.Close(); + //trash data, continue to flush by one packet. + FlushOnePacketL(); InitiateFirstChunkReceiveL(); return; - - } if ((iDataLength - KUSBHeaderSize) == 0) @@ -617,7 +609,14 @@ SetStreamState(EReceiveComplete); } } - else if (iReceiveChunkData.MaxLength() == iReceiveChunkData.Length()) + else if (iReceiveChunkData.MaxLength() == KUSBHeaderSize + && iReceiveChunkData.Length() < KUSBHeaderSize) + { + //trash data received, just diacard it and initiate next receiving + InitiateFirstChunkReceiveL(); + return; + } + else if (iReceiveChunkData.MaxLength() == iReceiveChunkData.Length()) { // USB Control request setup or data packet is received from Control EP. // All the desired data should be received. @@ -692,7 +691,7 @@ // 1. MTP file receiving: MTP type file never returns KMTPChunkSequenceCompletion,It can be received // one part after another. Also it can be commited mutiple times. // 2. Other MTP datatype receiving during the middle of data stream - __FLOG(_L8("Commiting write data chunk")); + __FLOG(_L8("Commiting write data chunk - 1")); needCommit = iReceiveDataSink->CommitChunkL(iReceiveChunkData); lastChunkCommited = ETrue; } @@ -702,7 +701,7 @@ { // It should be the end of MTP type file receiving since it never returns KMTPChunkSequenceCompletion. // it can be commited mutiple times. - __FLOG(_L8("Commiting write data chunk")); + __FLOG(_L8("Commiting write data chunk - 2")); needCommit = iReceiveDataSink->CommitChunkL(iReceiveChunkData); } else if ((iChunkStatus == KMTPChunkSequenceCompletion) @@ -711,9 +710,22 @@ { // The last chunk data which type is any other MTP data type than MTP file type. // It will not be commited until all the chunk data is received. - __FLOG(_L8("Commiting write data chunk")); + __FLOG(_L8("Commiting write data chunk - 3")); needCommit = iReceiveDataSink->CommitChunkL(iReceiveChunkData); - } + } + else if ((iChunkStatus == KMTPChunkSequenceCompletion) + && !endStream + && (iReceiveChunkData.Length() == iReceiveChunkData.MaxLength())) + { + // The last chunk data is received and chunk has been filled up: + // just flush one packet and set endStream true and commit received data. + // This condition tries to make MTP more robust if DP forgets to handle data-out phase. + __FLOG(_L8("Commiting write data chunk - 4")); + + FlushOnePacketL(); + endStream = ETrue; + needCommit = iReceiveDataSink->CommitChunkL(iReceiveChunkData); + } } // Fetch the next read data chunk. @@ -1110,3 +1122,15 @@ readBuf.Close(); } } + +void CMTPUsbEpBase::FlushOnePacketL() + { + //trash data, continue to flush. + TRequestStatus status; + RBuf8 readBuf; + readBuf.CreateL(KMaxPacketTypeBulkHS); + Connection().Ldd().ReadPacket(status, EndpointNumber(), readBuf, KMaxPacketTypeBulkHS); + User::WaitForRequest(status); + RDebug::Print(_L("CMTPUsbEpBase::ProcessFirstReceivedChunkL(), trash data length = %d"), readBuf.Length()); + readBuf.Close(); + } diff -r 883e91c086aa -r 48c22c726cf9 package_definition.xml --- a/package_definition.xml Tue Jul 06 15:13:34 2010 +0300 +++ b/package_definition.xml Wed Aug 18 10:38:51 2010 +0300 @@ -1,56 +1,103 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 883e91c086aa -r 48c22c726cf9 package_map.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/package_map.xml Wed Aug 18 10:38:51 2010 +0300 @@ -0,0 +1,1 @@ +