383 iCachedHandle = 0; |
383 iCachedHandle = 0; |
384 iCachedSuidHash = 0; |
384 iCachedSuidHash = 0; |
385 TBool needToInsert = EFalse; |
385 TBool needToInsert = EFalse; |
386 TBool needUpdateOwner = EFalse; |
386 TBool needUpdateOwner = EFalse; |
387 TUint dpId(aObject.Uint(CMTPObjectMetaData::EDataProviderId)); |
387 TUint dpId(aObject.Uint(CMTPObjectMetaData::EDataProviderId)); |
|
388 |
388 TFileName suid; |
389 TFileName suid; |
389 suid.CopyLC(aObject.DesC(CMTPObjectMetaData::ESuid)); |
390 suid.CopyLC(aObject.DesC(CMTPObjectMetaData::ESuid)); |
390 TUint32 suidHash = DefaultHash::Des16(suid); |
391 TUint32 suidHash = DefaultHash::Des16(suid); |
391 TUint32 parentHandle = aObject.Uint(CMTPObjectMetaData::EParentHandle); |
392 TUint32 parentHandle = aObject.Uint(CMTPObjectMetaData::EParentHandle); |
392 TUint32 handle = KMTPHandleNone, handleInDB = KMTPHandleAll; |
393 TUint32 handle = KMTPHandleNone, handleInDB = KMTPHandleAll; |
393 TInt64 id = 0; |
394 TInt64 id = 0; |
394 // Check if the dp is enumerating |
395 // Check if the dp is enumerating |
395 if (iSingletons.DpController().EnumerateState() != CMTPDataProviderController::EEnumerated && iCacheExist) |
396 if (iSingletons.DpController().EnumerateState() != CMTPDataProviderController::EEnumeratedFulllyCompleted && iCacheExist) |
396 { |
397 { |
397 //it is in the object enumeration phase. |
398 //it is in the object enumeration phase. |
398 // if it's see if we have an object with the same SUID |
399 // if it's see if we have an object with the same SUID |
399 //When the MTP server startup the object enumeration, it will fetch all of the object's (SUIDHash and Handles) into in-memory ordered array. |
400 //When the MTP server startup the object enumeration, it will fetch all of the object's (SUIDHash and Handles) into in-memory ordered array. |
400 //this function is to try to match the handleID for the incoming suidHash/SUID/DPID, if matched in memory, it will return the handleID |
401 //this function is to try to match the handleID for the incoming suidHash/SUID/DPID, if matched in memory, it will return the handleID |
684 |
686 |
685 void CMTPObjectStore::RemoveObjectL(const TMTPTypeUint32& aHandle) |
687 void CMTPObjectStore::RemoveObjectL(const TMTPTypeUint32& aHandle) |
686 { |
688 { |
687 if (LocateByHandleL(aHandle.Value())) |
689 if (LocateByHandleL(aHandle.Value())) |
688 { |
690 { |
689 if (iSingletons.DpController().EnumerateState() != CMTPDataProviderController::EEnumerated && |
691 if (iSingletons.DpController().EnumerateState() != CMTPDataProviderController::EEnumeratedFulllyCompleted && |
690 IsMediaFormat(iBatched.ColUint16(EObjectStoreFormatCode))) |
692 IsMediaFormat(iBatched.ColUint16(EObjectStoreFormatCode))) |
691 { |
693 { |
692 iMtpDeltaDataMgr->UpdateDeltaDataTableL(iBatched.ColInt64(EObjectStorePOUID), CMtpDeltaDataMgr::EDeleted); |
694 iMtpDeltaDataMgr->UpdateDeltaDataTableL(iBatched.ColInt64(EObjectStorePOUID), CMtpDeltaDataMgr::EDeleted); |
693 } |
695 } |
694 iCachedSuidHash = 0; |
696 iCachedSuidHash = 0; |
700 |
702 |
701 void CMTPObjectStore::RemoveObjectL(const TDesC& aSuid) |
703 void CMTPObjectStore::RemoveObjectL(const TDesC& aSuid) |
702 { |
704 { |
703 if(LocateBySuidL(aSuid)) |
705 if(LocateBySuidL(aSuid)) |
704 { |
706 { |
705 if (iSingletons.DpController().EnumerateState() != CMTPDataProviderController::EEnumerated && |
707 if (iSingletons.DpController().EnumerateState() != CMTPDataProviderController::EEnumeratedFulllyCompleted && |
706 IsMediaFormat(iBatched_SuidHashID.ColUint16(EObjectStoreFormatCode))) |
708 IsMediaFormat(iBatched_SuidHashID.ColUint16(EObjectStoreFormatCode))) |
707 { |
709 { |
708 iMtpDeltaDataMgr->UpdateDeltaDataTableL(iBatched_SuidHashID.ColInt64(EObjectStorePOUID), CMtpDeltaDataMgr::EDeleted); |
710 iMtpDeltaDataMgr->UpdateDeltaDataTableL(iBatched_SuidHashID.ColInt64(EObjectStorePOUID), CMtpDeltaDataMgr::EDeleted); |
709 } |
711 } |
710 iCachedSuidHash = 0; |
712 iCachedSuidHash = 0; |