21 #include <mtp/cmtpobjectmetadata.h> |
21 #include <mtp/cmtpobjectmetadata.h> |
22 #include <mtp/cmtptypestring.h> |
22 #include <mtp/cmtptypestring.h> |
23 |
23 |
24 #include "cmtpgetobjectinfo.h" |
24 #include "cmtpgetobjectinfo.h" |
25 #include "mtpdppanic.h" |
25 #include "mtpdppanic.h" |
|
26 #include "cmtpfsentrycache.h" |
|
27 |
|
28 __FLOG_STMT(_LIT8(KComponent,"MTPGetObjectInfo");) |
26 |
29 |
27 /** |
30 /** |
28 Verification data for GetObjectInfo request |
31 Verification data for GetObjectInfo request |
29 */ |
32 */ |
30 const TMTPRequestElementInfo KMTPGetObjectInfoPolicy[] = |
33 const TMTPRequestElementInfo KMTPGetObjectInfoPolicy[] = |
53 */ |
56 */ |
54 EXPORT_C CMTPGetObjectInfo::~CMTPGetObjectInfo() |
57 EXPORT_C CMTPGetObjectInfo::~CMTPGetObjectInfo() |
55 { |
58 { |
56 delete iObjectInfoToBuild; |
59 delete iObjectInfoToBuild; |
57 iDpSingletons.Close(); |
60 iDpSingletons.Close(); |
|
61 __FLOG_CLOSE; |
58 } |
62 } |
59 |
63 |
60 /** |
64 /** |
61 Standard c++ constructor |
65 Standard c++ constructor |
62 */ |
66 */ |
63 CMTPGetObjectInfo::CMTPGetObjectInfo(MMTPDataProviderFramework& aFramework, |
67 CMTPGetObjectInfo::CMTPGetObjectInfo(MMTPDataProviderFramework& aFramework, |
64 MMTPConnection& aConnection) |
68 MMTPConnection& aConnection) |
65 :CMTPRequestProcessor(aFramework, aConnection, sizeof(KMTPGetObjectInfoPolicy)/sizeof(TMTPRequestElementInfo), KMTPGetObjectInfoPolicy), |
69 :CMTPRequestProcessor(aFramework, aConnection, sizeof(KMTPGetObjectInfoPolicy)/sizeof(TMTPRequestElementInfo), KMTPGetObjectInfoPolicy), |
66 iRfs(aFramework.Fs()) |
70 iRfs(aFramework.Fs()) |
67 { |
71 { |
|
72 __FLOG_OPEN(KMTPSubsystem, KComponent); |
68 } |
73 } |
69 |
74 |
70 /** |
75 /** |
71 GetObjectInfo request handler |
76 GetObjectInfo request handler |
72 */ |
77 */ |
95 //does not take owernship |
100 //does not take owernship |
96 CMTPObjectMetaData* objectInfoFromStore = iRequestChecker->GetObjectInfo(objectHandle); |
101 CMTPObjectMetaData* objectInfoFromStore = iRequestChecker->GetObjectInfo(objectHandle); |
97 __ASSERT_DEBUG(objectInfoFromStore, Panic(EMTPDpObjectNull)); |
102 __ASSERT_DEBUG(objectInfoFromStore, Panic(EMTPDpObjectNull)); |
98 |
103 |
99 TEntry fileEntry; |
104 TEntry fileEntry; |
100 User::LeaveIfError(iRfs.Entry(objectInfoFromStore->DesC(CMTPObjectMetaData::ESuid), fileEntry)); |
105 TInt err = iRfs.Entry(objectInfoFromStore->DesC(CMTPObjectMetaData::ESuid), fileEntry); |
|
106 |
|
107 if ( err != KErrNone ) |
|
108 { |
|
109 if( (iDpSingletons.CopyingBigFileCache().TargetHandle() == objectHandle) && |
|
110 (iDpSingletons.CopyingBigFileCache().IsOnGoing())) |
|
111 { |
|
112 // The object is being copied, it is not created in fs yet. Use its cache entry to get objectinfo |
|
113 __FLOG(_L8("BuildObjectInfoL - The object is being copied, use its cache entry to get objectinfo")); |
|
114 fileEntry = iDpSingletons.CopyingBigFileCache().FileEntry(); |
|
115 err = KErrNone; |
|
116 } |
|
117 else if( (iDpSingletons.MovingBigFileCache().TargetHandle() == objectHandle) && |
|
118 (iDpSingletons.MovingBigFileCache().IsOnGoing())) |
|
119 { |
|
120 // The object is being moved, it is not created in fs yet. Use its cache entry to get objectinfo |
|
121 __FLOG(_L8("BuildObjectInfoL - The object is being moved, use its cache entry to get objectinfo")); |
|
122 fileEntry = iDpSingletons.MovingBigFileCache().FileEntry(); |
|
123 err = KErrNone; |
|
124 } |
|
125 } |
|
126 |
|
127 User::LeaveIfError(err); |
101 |
128 |
102 //1. storage id |
129 //1. storage id |
103 iObjectInfoToBuild->SetUint32L(CMTPTypeObjectInfo::EStorageID, objectInfoFromStore->Uint(CMTPObjectMetaData::EStorageId)); |
130 iObjectInfoToBuild->SetUint32L(CMTPTypeObjectInfo::EStorageID, objectInfoFromStore->Uint(CMTPObjectMetaData::EStorageId)); |
104 |
131 |
105 //2. object format |
132 //2. object format |