23 #include <mtp/mtpprotocolconstants.h> |
23 #include <mtp/mtpprotocolconstants.h> |
24 #include <mtp/tmtptyperequest.h> |
24 #include <mtp/tmtptyperequest.h> |
25 |
25 |
26 #include "cmtpgetobject.h" |
26 #include "cmtpgetobject.h" |
27 #include "mtpdppanic.h" |
27 #include "mtpdppanic.h" |
|
28 #include "OstTraceDefinitions.h" |
|
29 #ifdef OST_TRACE_COMPILER_IN_USE |
|
30 #include "cmtpgetobjectTraces.h" |
|
31 #endif |
28 |
32 |
29 // Class constants. |
|
30 __FLOG_STMT(_LIT8(KComponent,"GetObject");) |
|
31 |
33 |
32 /** |
34 /** |
33 Verification data for the GetNumObjects request |
35 Verification data for the GetNumObjects request |
34 */ |
36 */ |
35 const TMTPRequestElementInfo KMTPGetObjectPolicy[] = |
37 const TMTPRequestElementInfo KMTPGetObjectPolicy[] = |
77 /** |
78 /** |
78 Second-phase constructor. |
79 Second-phase constructor. |
79 */ |
80 */ |
80 void CMTPGetObject::ConstructL() |
81 void CMTPGetObject::ConstructL() |
81 { |
82 { |
82 __FLOG_OPEN(KMTPSubsystem, KComponent); |
83 OstTraceFunctionEntry0( CMTPGETOBJECT_CONSTRUCTL_ENTRY ); |
83 __FLOG(_L8("ConstructL - Entry")); |
84 OstTraceFunctionExit0( CMTPGETOBJECT_CONSTRUCTL_EXIT ); |
84 __FLOG(_L8("ConstructL - Exit")); |
|
85 } |
85 } |
86 |
86 |
87 /** |
87 /** |
88 GetObject request handler |
88 GetObject request handler |
89 */ |
89 */ |
90 void CMTPGetObject::ServiceL() |
90 void CMTPGetObject::ServiceL() |
91 { |
91 { |
92 __FLOG(_L8("ServiceL - Entry")); |
92 OstTraceFunctionEntry0( CMTPGETOBJECT_SERVICEL_ENTRY ); |
93 __ASSERT_DEBUG(iRequestChecker, Panic(EMTPDpRequestCheckNull)); |
93 __ASSERT_DEBUG(iRequestChecker, Panic(EMTPDpRequestCheckNull)); |
94 TUint32 objectHandle = Request().Uint32(TMTPTypeRequest::ERequestParameter1); |
94 TUint32 objectHandle = Request().Uint32(TMTPTypeRequest::ERequestParameter1); |
95 //does not take ownership |
95 //does not take ownership |
96 CMTPObjectMetaData* objectInfo = iRequestChecker->GetObjectInfo(objectHandle); |
96 CMTPObjectMetaData* objectInfo = iRequestChecker->GetObjectInfo(objectHandle); |
97 if (!objectInfo) |
97 if (!objectInfo) |
116 else |
116 else |
117 { |
117 { |
118 SendResponseL(EMTPRespCodeAccessDenied); |
118 SendResponseL(EMTPRespCodeAccessDenied); |
119 } |
119 } |
120 } |
120 } |
121 __FLOG(_L8("ServiceL - Exit")); |
121 OstTraceFunctionExit0( CMTPGETOBJECT_SERVICEL_EXIT ); |
122 } |
122 } |
123 |
123 |
124 |
124 |
125 /** |
125 /** |
126 Build the file object data set for the file requested |
126 Build the file object data set for the file requested |
127 @param aFileName The file name of the requested object |
127 @param aFileName The file name of the requested object |
128 */ |
128 */ |
129 void CMTPGetObject::BuildFileObjectL(const TDesC& aFileName) |
129 void CMTPGetObject::BuildFileObjectL(const TDesC& aFileName) |
130 { |
130 { |
131 __FLOG(_L8("BuildFileObjectL - Entry")); |
131 OstTraceFunctionEntry0( CMTPGETOBJECT_BUILDFILEOBJECTL_ENTRY ); |
132 delete iFileObject; |
132 delete iFileObject; |
133 iFileObject = NULL; |
133 iFileObject = NULL; |
134 iFileObject = CMTPTypeFile::NewL(iFramework.Fs(), aFileName, EFileRead); |
134 iFileObject = CMTPTypeFile::NewL(iFramework.Fs(), aFileName, EFileRead); |
135 __FLOG(_L8("BuildFileObjectL - Exit")); |
135 OstTraceFunctionExit0( CMTPGETOBJECT_BUILDFILEOBJECTL_EXIT ); |
136 } |
136 } |
137 |
137 |
138 |
138 |
139 /** |
139 /** |
140 Handle the response phase of the current request |
140 Handle the response phase of the current request |
141 @return EFalse |
141 @return EFalse |
142 */ |
142 */ |
143 TBool CMTPGetObject::DoHandleResponsePhaseL() |
143 TBool CMTPGetObject::DoHandleResponsePhaseL() |
144 { |
144 { |
145 __FLOG(_L8("DoHandleResponsePhaseL - Entry")); |
145 OstTraceFunctionEntry0( CMTPGETOBJECT_DOHANDLERESPONSEPHASEL_ENTRY ); |
146 TMTPResponseCode responseCode = (iCancelled ? EMTPRespCodeIncompleteTransfer : iError); |
146 TMTPResponseCode responseCode = (iCancelled ? EMTPRespCodeIncompleteTransfer : iError); |
147 SendResponseL(responseCode); |
147 SendResponseL(responseCode); |
148 __FLOG(_L8("DoHandleResponsePhaseL - Exit")); |
148 OstTraceFunctionExit0( CMTPGETOBJECT_DOHANDLERESPONSEPHASEL_EXIT ); |
149 return EFalse; |
149 return EFalse; |
150 } |
150 } |