26 #include "cmtpgetobjectproplist.h" |
26 #include "cmtpgetobjectproplist.h" |
27 #include "cmtpfsexclusionmgr.h" |
27 #include "cmtpfsexclusionmgr.h" |
28 #include "mtpdpconst.h" |
28 #include "mtpdpconst.h" |
29 #include "mtpdppanic.h" |
29 #include "mtpdppanic.h" |
30 #include "cmtpfsentrycache.h" |
30 #include "cmtpfsentrycache.h" |
31 |
31 #include "mtpdebug.h" |
32 __FLOG_STMT(_LIT8(KComponent,"MTPGetObjectPropList");) |
32 #include "OstTraceDefinitions.h" |
|
33 #ifdef OST_TRACE_COMPILER_IN_USE |
|
34 #include "cmtpgetobjectproplistTraces.h" |
|
35 #endif |
|
36 |
33 |
37 |
34 /** |
38 /** |
35 Verification data for the GetNumObjects request |
39 Verification data for the GetNumObjects request |
36 */ |
40 */ |
37 const TMTPRequestElementInfo KMTPGetObjectPropListPolicy[] = |
41 const TMTPRequestElementInfo KMTPGetObjectPropListPolicy[] = |
48 return self; |
52 return self; |
49 } |
53 } |
50 |
54 |
51 EXPORT_C CMTPGetObjectPropList::~CMTPGetObjectPropList() |
55 EXPORT_C CMTPGetObjectPropList::~CMTPGetObjectPropList() |
52 { |
56 { |
|
57 OstTraceFunctionEntry0( CMTPGETOBJECTPROPLIST_CMTPGETOBJECTPROPLIST_DES_ENTRY ); |
53 delete iHandles; |
58 delete iHandles; |
54 delete iPropertyList; |
59 delete iPropertyList; |
55 iDpSingletons.Close(); |
60 iDpSingletons.Close(); |
56 delete iObjMeta; |
61 delete iObjMeta; |
57 __FLOG_CLOSE; |
62 OstTraceFunctionExit0( CMTPGETOBJECTPROPLIST_CMTPGETOBJECTPROPLIST_DES_EXIT ); |
58 } |
63 } |
59 |
64 |
60 void CMTPGetObjectPropList::ServiceL() |
65 void CMTPGetObjectPropList::ServiceL() |
61 { |
66 { |
62 __FLOG(_L8("ServiceL - Entry")); |
67 OstTraceFunctionEntry0( CMTPGETOBJECTPROPLIST_SERVICEL_ENTRY ); |
63 TUint32 propCode(Request().Uint32(TMTPTypeRequest::ERequestParameter3)); |
68 TUint32 propCode(Request().Uint32(TMTPTypeRequest::ERequestParameter3)); |
64 TUint32 groupCode(Request().Uint32(TMTPTypeRequest::ERequestParameter4)); |
69 TUint32 groupCode(Request().Uint32(TMTPTypeRequest::ERequestParameter4)); |
65 |
70 |
66 if( ( propCode != 0 ) || ( (groupCode !=0) && (groupCode <= KMTPDpPropertyGroupNumber) ) ) |
71 if( ( propCode != 0 ) || ( (groupCode !=0) && (groupCode <= KMTPDpPropertyGroupNumber) ) ) |
67 { |
72 { |
78 { |
83 { |
79 if( (iDpSingletons.CopyingBigFileCache().TargetHandle() == handle) && |
84 if( (iDpSingletons.CopyingBigFileCache().TargetHandle() == handle) && |
80 (iDpSingletons.CopyingBigFileCache().IsOnGoing())) |
85 (iDpSingletons.CopyingBigFileCache().IsOnGoing())) |
81 { |
86 { |
82 // The object is being copied, it is not created in fs yet. Use its cache entry to get properties |
87 // The object is being copied, it is not created in fs yet. Use its cache entry to get properties |
83 __FLOG(_L8("ServiceL - The object is being copied, use its cache entry to get properties")); |
88 OstTrace0( TRACE_NORMAL, CMTPGETOBJECTPROPLIST_SERVICEL, |
|
89 "ServiceL - The object is being copied, use its cache entry to get properties" ); |
84 iFileEntry = iDpSingletons.CopyingBigFileCache().FileEntry(); |
90 iFileEntry = iDpSingletons.CopyingBigFileCache().FileEntry(); |
85 err = KErrNone; |
91 err = KErrNone; |
86 } |
92 } |
87 else if( (iDpSingletons.MovingBigFileCache().TargetHandle() == handle) && |
93 else if( (iDpSingletons.MovingBigFileCache().TargetHandle() == handle) && |
88 (iDpSingletons.MovingBigFileCache().IsOnGoing())) |
94 (iDpSingletons.MovingBigFileCache().IsOnGoing())) |
89 { |
95 { |
90 // The object is being moved, it is not created in fs yet. Use its cache entry to get properties |
96 // The object is being moved, it is not created in fs yet. Use its cache entry to get properties |
91 __FLOG(_L8("ServiceL - The object is being moved, use its cache entry to get properties")); |
97 OstTrace0( TRACE_NORMAL, DUP1_CMTPGETOBJECTPROPLIST_SERVICEL, |
|
98 "ServiceL - The object is being moved, use its cache entry to get properties" ); |
92 iFileEntry = iDpSingletons.MovingBigFileCache().FileEntry(); |
99 iFileEntry = iDpSingletons.MovingBigFileCache().FileEntry(); |
93 err = KErrNone; |
100 err = KErrNone; |
94 } |
101 } |
95 } |
102 } |
96 |
103 |
97 User::LeaveIfError(err); |
104 LEAVEIFERROR(err, |
98 |
105 OstTraceExt2( TRACE_ERROR, DUP2_CMTPGETOBJECTPROPLIST_SERVICEL, |
|
106 "Can't get entry details for %S even after error handling! error code %d", iObjMeta->DesC(CMTPObjectMetaData::ESuid), err)); |
|
107 |
99 if (propCode == KMaxTUint) |
108 if (propCode == KMaxTUint) |
100 { |
109 { |
101 ServiceAllPropertiesL(handle); |
110 ServiceAllPropertiesL(handle); |
102 } |
111 } |
103 else if( propCode == 0) |
112 else if( propCode == 0) |
113 //else |
122 //else |
114 //it means the groupcode is not supported, return EMTPRespCodeGroupNotSupported(0xA805) response. |
123 //it means the groupcode is not supported, return EMTPRespCodeGroupNotSupported(0xA805) response. |
115 //but we use one empty ObjectPropList to replace the EMTPRespCodeGroupNotSupported(0xA805) response. |
124 //but we use one empty ObjectPropList to replace the EMTPRespCodeGroupNotSupported(0xA805) response. |
116 |
125 |
117 SendDataL(*iPropertyList); |
126 SendDataL(*iPropertyList); |
118 |
127 |
119 __FLOG(_L8("ServiceL - Exit")); |
128 OstTraceFunctionExit0( CMTPGETOBJECTPROPLIST_SERVICEL_EXIT ); |
120 } |
129 } |
121 |
130 |
122 TMTPResponseCode CMTPGetObjectPropList::CheckRequestL() |
131 TMTPResponseCode CMTPGetObjectPropList::CheckRequestL() |
123 { |
132 { |
124 TMTPResponseCode result = CMTPRequestProcessor::CheckRequestL(); |
133 TMTPResponseCode result = CMTPRequestProcessor::CheckRequestL(); |
141 } |
150 } |
142 |
151 |
143 CMTPGetObjectPropList::CMTPGetObjectPropList(MMTPDataProviderFramework& aFramework, MMTPConnection& aConnection) : |
152 CMTPGetObjectPropList::CMTPGetObjectPropList(MMTPDataProviderFramework& aFramework, MMTPConnection& aConnection) : |
144 CMTPRequestProcessor(aFramework, aConnection, (sizeof(KMTPGetObjectPropListPolicy) / sizeof(TMTPRequestElementInfo)), KMTPGetObjectPropListPolicy) |
153 CMTPRequestProcessor(aFramework, aConnection, (sizeof(KMTPGetObjectPropListPolicy) / sizeof(TMTPRequestElementInfo)), KMTPGetObjectPropListPolicy) |
145 { |
154 { |
146 __FLOG_OPEN(KMTPSubsystem, KComponent); |
|
147 } |
155 } |
148 |
156 |
149 void CMTPGetObjectPropList::ConstructL() |
157 void CMTPGetObjectPropList::ConstructL() |
150 { |
158 { |
|
159 OstTraceFunctionEntry0( CMTPGETOBJECTPROPLIST_CONSTRUCTL_ENTRY ); |
151 iDpSingletons.OpenL(iFramework); |
160 iDpSingletons.OpenL(iFramework); |
152 iPropertyList = CMTPTypeObjectPropList::NewL(); |
161 iPropertyList = CMTPTypeObjectPropList::NewL(); |
153 iObjMeta = CMTPObjectMetaData::NewL(); |
162 iObjMeta = CMTPObjectMetaData::NewL(); |
|
163 OstTraceFunctionExit0( CMTPGETOBJECTPROPLIST_CONSTRUCTL_EXIT ); |
154 } |
164 } |
155 |
165 |
156 TMTPResponseCode CMTPGetObjectPropList::CheckFormatL() const |
166 TMTPResponseCode CMTPGetObjectPropList::CheckFormatL() const |
157 { |
167 { |
158 TMTPResponseCode response = EMTPRespCodeOK; |
168 TMTPResponseCode response = EMTPRespCodeOK; |
475 CMTPTypeObjectPropListElement& propElem = iPropertyList->ReservePropElemL(aHandle, aPropCode); |
485 CMTPTypeObjectPropListElement& propElem = iPropertyList->ReservePropElemL(aHandle, aPropCode); |
476 propElem.SetUint32L(CMTPTypeObjectPropListElement::EValue, 0x0000); |
486 propElem.SetUint32L(CMTPTypeObjectPropListElement::EValue, 0x0000); |
477 iPropertyList->CommitPropElemL(propElem); |
487 iPropertyList->CommitPropElemL(propElem); |
478 } |
488 } |
479 } |
489 } |
480 break; |
490 break; |
|
491 case EMTPObjectPropCodeHidden: |
|
492 { |
|
493 TBool isHidden = iFileEntry.IsHidden(); |
|
494 CMTPTypeObjectPropListElement& propElem = iPropertyList->ReservePropElemL(aHandle, aPropCode); |
|
495 if ( isHidden ) |
|
496 { |
|
497 propElem.SetUint16L(CMTPTypeObjectPropListElement::EValue, EMTPHidden); |
|
498 } |
|
499 else |
|
500 { |
|
501 propElem.SetUint16L(CMTPTypeObjectPropListElement::EValue, EMTPVisible); |
|
502 } |
|
503 iPropertyList->CommitPropElemL(propElem); |
|
504 } |
|
505 break; |
481 default: |
506 default: |
|
507 OstTrace1(TRACE_ERROR, CMTPGETOBJECTPROPLIST_SERVICEONEOBJECTPROPERTYL, "invalid property code %d", aPropCode); |
482 User::Leave( KErrNotSupported ); |
508 User::Leave( KErrNotSupported ); |
483 break; |
509 break; |
484 } |
510 } |
485 } |
511 } |
486 } |
512 } |