24 #include "cmtpdataprovider.h" |
24 #include "cmtpdataprovider.h" |
25 #include "cmtpsendobjectinfo.h" |
25 #include "cmtpsendobjectinfo.h" |
26 #include "mtpproxydppanic.h" |
26 #include "mtpproxydppanic.h" |
27 #include "cmtpproxydpconfigmgr.h" |
27 #include "cmtpproxydpconfigmgr.h" |
28 #include "cmtpstoragemgr.h" |
28 #include "cmtpstoragemgr.h" |
29 |
29 #include "OstTraceDefinitions.h" |
30 __FLOG_STMT( _LIT8( KComponent,"PrxySendObjectInfo" ); ) |
30 #ifdef OST_TRACE_COMPILER_IN_USE |
|
31 #include "cmtpsendobjectinfoTraces.h" |
|
32 #endif |
|
33 |
31 |
34 |
32 /** |
35 /** |
33 Verification data for the SendObjectInfo request |
36 Verification data for the SendObjectInfo request |
34 */ |
37 */ |
35 const TMTPRequestElementInfo KMTPSendObjectInfoPolicy[] = |
38 const TMTPRequestElementInfo KMTPSendObjectInfoPolicy[] = |
80 /** |
82 /** |
81 Second phase constructor. |
83 Second phase constructor. |
82 */ |
84 */ |
83 void CMTPSendObjectInfo::ConstructL() |
85 void CMTPSendObjectInfo::ConstructL() |
84 { |
86 { |
85 __FLOG_OPEN(KMTPSubsystem, KComponent); |
87 OstTraceFunctionEntry0( CMTPSENDOBJECTINFO_CONSTRUCTL_ENTRY ); |
86 __FLOG(_L8("ConstructL - Entry")); |
|
87 |
88 |
88 iSingletons.OpenL(); |
89 iSingletons.OpenL(); |
89 |
90 |
90 __FLOG(_L8("ConstructL - Exit")); |
91 OstTraceFunctionExit0( CMTPSENDOBJECTINFO_CONSTRUCTL_EXIT ); |
91 } |
92 } |
92 |
93 |
93 /** |
94 /** |
94 SendObjectInfo/SendObject request handler |
95 SendObjectInfo/SendObject request handler |
95 NOTE: SendObjectInfo has to be comes before SendObject requests. To maintain the state information |
96 NOTE: SendObjectInfo has to be comes before SendObject requests. To maintain the state information |
122 Handling the completing phase of SendObjectInfo request |
123 Handling the completing phase of SendObjectInfo request |
123 @return ETrue if the specified object can be saved on the specified location, otherwise, EFalse |
124 @return ETrue if the specified object can be saved on the specified location, otherwise, EFalse |
124 */ |
125 */ |
125 void CMTPSendObjectInfo::DoHandleSendObjectInfoCompleteL() |
126 void CMTPSendObjectInfo::DoHandleSendObjectInfoCompleteL() |
126 { |
127 { |
127 __FLOG(_L8("DoHandleSendObjectInfoCompleteL - Entry")); |
128 OstTraceFunctionEntry0( CMTPSENDOBJECTINFO_DOHANDLESENDOBJECTINFOCOMPLETEL_ENTRY ); |
128 |
129 |
129 CMTPParserRouter::TRoutingParameters params(*iRequest, iConnection); |
130 CMTPParserRouter::TRoutingParameters params(*iRequest, iConnection); |
130 iSingletons.Router().ParseOperationRequestL(params); |
131 iSingletons.Router().ParseOperationRequestL(params); |
131 TBool fileFlag=EFalse; |
132 TBool fileFlag=EFalse; |
132 RArray<TUint> targets; |
133 RArray<TUint> targets; |
133 CleanupClosePushL(targets); |
134 CleanupClosePushL(targets); |
134 params.SetParam(CMTPParserRouter::TRoutingParameters::EParamFormatCode, iObjectInfo->Uint16L(CMTPTypeObjectInfo::EObjectFormat)); |
135 params.SetParam(CMTPParserRouter::TRoutingParameters::EParamFormatCode, iObjectInfo->Uint16L(CMTPTypeObjectInfo::EObjectFormat)); |
135 |
136 |
136 iProxyDpSingletons.OpenL(iFramework); |
137 iProxyDpSingletons.OpenL(iFramework); |
137 TInt index(KErrNotFound); |
138 TInt index(KErrNotFound); |
138 const TUint16 formatCode=iObjectInfo->Uint16L(CMTPTypeObjectInfo::EObjectFormat); |
139 const TUint16 formatCode=iObjectInfo->Uint16L(CMTPTypeObjectInfo::EObjectFormat); |
139 __FLOG_1( _L8("formatCode = %d"), formatCode ); |
140 OstTrace1(TRACE_NORMAL, CMTPSENDOBJECTINFO_DOHANDLESENDOBJECTINFOCOMPLETEL, "formatCode = %d", formatCode); |
140 switch(formatCode) |
141 switch(formatCode) |
141 { |
142 { |
142 case EMTPFormatCodeAssociation: |
143 case EMTPFormatCodeAssociation: |
143 params.SetParam(CMTPParserRouter::TRoutingParameters::EParamFormatSubCode, iObjectInfo->Uint16L(CMTPTypeObjectInfo::EAssociationType)); |
144 params.SetParam(CMTPParserRouter::TRoutingParameters::EParamFormatSubCode, iObjectInfo->Uint16L(CMTPTypeObjectInfo::EAssociationType)); |
144 break; |
145 break; |
145 |
146 |
146 case EMTPFormatCodeScript: |
147 case EMTPFormatCodeScript: |
147 { |
148 { |
148 __FLOG_1( _L8("formatCode = %d"), EMTPFormatCodeScript ); |
|
149 const TDesC& filename = iObjectInfo->StringCharsL(CMTPTypeObjectInfo::EFilename); |
149 const TDesC& filename = iObjectInfo->StringCharsL(CMTPTypeObjectInfo::EFilename); |
150 HBufC* lowFileName = HBufC::NewLC(filename.Length()); |
150 HBufC* lowFileName = HBufC::NewLC(filename.Length()); |
151 TPtr16 prt(lowFileName->Des()); |
151 TPtr16 prt(lowFileName->Des()); |
152 prt.Append(filename); |
152 prt.Append(filename); |
153 prt.LowerCase(); |
153 prt.LowerCase(); |
154 __FLOG_1( _L8("lowFileName = %s"), &prt ); |
154 OstTraceExt1(TRACE_NORMAL, DUP1_CMTPSENDOBJECTINFO_DOHANDLESENDOBJECTINFOCOMPLETEL, |
|
155 "lowFileName = %S", prt); |
155 if (iProxyDpSingletons.FrameworkConfig().GetFileName(prt,index) ) |
156 if (iProxyDpSingletons.FrameworkConfig().GetFileName(prt,index) ) |
156 { |
157 { |
157 fileFlag=ETrue; |
158 fileFlag=ETrue; |
158 } |
159 } |
159 CleanupStack::PopAndDestroy(lowFileName); |
160 CleanupStack::PopAndDestroy(lowFileName); |
164 default: |
165 default: |
165 params.SetParam(CMTPParserRouter::TRoutingParameters::EParamFormatSubCode, EMTPAssociationTypeUndefined); |
166 params.SetParam(CMTPParserRouter::TRoutingParameters::EParamFormatSubCode, EMTPAssociationTypeUndefined); |
166 break; |
167 break; |
167 } |
168 } |
168 |
169 |
169 __FLOG_1( _L8("fileFlag = %d"), fileFlag ); |
170 OstTrace1( TRACE_NORMAL, DUP2_CMTPSENDOBJECTINFO_DOHANDLESENDOBJECTINFOCOMPLETEL, "fileFlag = %d", fileFlag); |
|
171 |
170 if(fileFlag) |
172 if(fileFlag) |
171 { |
173 { |
172 TInt syncdpid = iSingletons.DpController().DpId(iProxyDpSingletons.FrameworkConfig().GetDPId(index)); |
174 TInt syncdpid = iSingletons.DpController().DpId(iProxyDpSingletons.FrameworkConfig().GetDPId(index)); |
173 iSingletons.DpController().DataProviderL(syncdpid).ExecuteProxyRequestL(Request(), Connection(), *this); |
175 iSingletons.DpController().DataProviderL(syncdpid).ExecuteProxyRequestL(Request(), Connection(), *this); |
174 } |
176 } |
175 else |
177 else |
176 { |
178 { |
177 iSingletons.Router().RouteOperationRequestL(params, targets); |
179 iSingletons.Router().RouteOperationRequestL(params, targets); |
178 CMTPStorageMgr& storages(iSingletons.StorageMgr()); |
180 CMTPStorageMgr& storages(iSingletons.StorageMgr()); |
179 const TUint KStorageId = Request().Uint32(TMTPTypeResponse::EResponseParameter1); |
181 const TUint KStorageId = Request().Uint32(TMTPTypeResponse::EResponseParameter1); |
180 __FLOG_1( _L8("KStorageId = %d"), KStorageId ); |
182 OstTrace1(TRACE_NORMAL, DUP3_CMTPSENDOBJECTINFO_DOHANDLESENDOBJECTINFOCOMPLETEL, |
181 __FLOG_1( _L8("targets.Count() = %d"), targets.Count() ); |
183 "KStorageId = %d", KStorageId); |
|
184 OstTrace1(TRACE_NORMAL, DUP4_CMTPSENDOBJECTINFO_DOHANDLESENDOBJECTINFOCOMPLETEL, |
|
185 "targets.Count() = %d", targets.Count()); |
182 if( KMTPNotSpecified32 == KStorageId) |
186 if( KMTPNotSpecified32 == KStorageId) |
183 { |
187 { |
184 iSingletons.DpController().DataProviderL(targets[0]).ExecuteProxyRequestL(Request(), Connection(), *this); |
188 iSingletons.DpController().DataProviderL(targets[0]).ExecuteProxyRequestL(Request(), Connection(), *this); |
185 } |
189 } |
186 else if( storages.ValidStorageId(KStorageId) ) |
190 else if( storages.ValidStorageId(KStorageId) ) |
187 { |
191 { |
188 if(targets.Count() == 1) |
192 if(targets.Count() == 1) |
189 { |
193 { |
190 __FLOG_1( _L8("targets[0] = %d"), targets[0] ); |
194 OstTrace1(TRACE_NORMAL, DUP5_CMTPSENDOBJECTINFO_DOHANDLESENDOBJECTINFOCOMPLETEL, |
|
195 "targets[0] = %d", targets[0]); |
191 iSingletons.DpController().DataProviderL(targets[0]).ExecuteProxyRequestL(Request(), Connection(), *this); |
196 iSingletons.DpController().DataProviderL(targets[0]).ExecuteProxyRequestL(Request(), Connection(), *this); |
192 } |
197 } |
193 else |
198 else |
194 { |
199 { |
195 TInt dpID(KErrNotFound); |
200 TInt dpID(KErrNotFound); |
199 } |
204 } |
200 else |
205 else |
201 { |
206 { |
202 dpID = storages.PhysicalStorageOwner(KStorageId); |
207 dpID = storages.PhysicalStorageOwner(KStorageId); |
203 } |
208 } |
204 __FLOG_1( _L8("dpID = %d"), dpID ); |
209 OstTrace1(TRACE_NORMAL, DUP6_CMTPSENDOBJECTINFO_DOHANDLESENDOBJECTINFOCOMPLETEL, |
|
210 "dpID = %d", dpID); |
205 if( targets.Find( dpID ) == KErrNotFound ) |
211 if( targets.Find( dpID ) == KErrNotFound ) |
206 { |
212 { |
207 __FLOG(_L8("No target dp is found, so send one GeneralError response.")); |
213 OstTrace0( TRACE_NORMAL, DUP7_CMTPSENDOBJECTINFO_DOHANDLESENDOBJECTINFOCOMPLETEL, |
|
214 "No target dp is found, so send one GeneralError response." ); |
208 SendResponseL( EMTPRespCodeGeneralError ); |
215 SendResponseL( EMTPRespCodeGeneralError ); |
209 } |
216 } |
210 else |
217 else |
211 { |
218 { |
212 iSingletons.DpController().DataProviderL(dpID).ExecuteProxyRequestL(Request(), Connection(), *this); |
219 iSingletons.DpController().DataProviderL(dpID).ExecuteProxyRequestL(Request(), Connection(), *this); |
213 } |
220 } |
214 } |
221 } |
215 } |
222 } |
216 else |
223 else |
217 { |
224 { |
218 __FLOG(_L8("StorageID is invalid.")); |
225 OstTrace0( TRACE_NORMAL, DUP8_CMTPSENDOBJECTINFO_DOHANDLESENDOBJECTINFOCOMPLETEL,"StorageID is invalid." ); |
219 SendResponseL( EMTPRespCodeInvalidStorageID ); |
226 SendResponseL( EMTPRespCodeInvalidStorageID ); |
220 } |
227 } |
221 } |
228 } |
222 CleanupStack::PopAndDestroy(&targets); |
229 CleanupStack::PopAndDestroy(&targets); |
223 |
230 |
224 __FLOG(_L8("DoHandleSendObjectInfoCompleteL - Exit")); |
231 OstTraceFunctionExit0( CMTPSENDOBJECTINFO_DOHANDLESENDOBJECTINFOCOMPLETEL_EXIT ); |
225 } |
232 } |
226 |
233 |
227 #ifdef _DEBUG |
234 #ifdef _DEBUG |
228 void CMTPSendObjectInfo::ProxyReceiveDataL(MMTPType& aData, const TMTPTypeRequest& aRequest, MMTPConnection& aConnection, TRequestStatus& aStatus) |
235 void CMTPSendObjectInfo::ProxyReceiveDataL(MMTPType& aData, const TMTPTypeRequest& aRequest, MMTPConnection& aConnection, TRequestStatus& aStatus) |
229 #else |
236 #else |