30 #include "mmtpsvcobjecthandler.h" |
30 #include "mmtpsvcobjecthandler.h" |
31 |
31 |
32 #include "cmtpconnection.h" |
32 #include "cmtpconnection.h" |
33 #include "cmtpconnectionmgr.h" |
33 #include "cmtpconnectionmgr.h" |
34 #include "mtpsvcdpconst.h" |
34 #include "mtpsvcdpconst.h" |
|
35 #include "OstTraceDefinitions.h" |
|
36 #ifdef OST_TRACE_COMPILER_IN_USE |
|
37 #include "cmtpsvccompoundprocessorTraces.h" |
|
38 #endif |
|
39 |
35 |
40 |
36 // Class constants. |
41 // Class constants. |
37 __FLOG_STMT(_LIT8(KComponent,"SvcCompound");) |
|
38 |
42 |
39 EXPORT_C MMTPRequestProcessor* CMTPSvcCompoundProcessor::NewL(MMTPDataProviderFramework& aFramework, MMTPConnection& aConnection, MMTPServiceDataProvider& aDataProvider) |
43 EXPORT_C MMTPRequestProcessor* CMTPSvcCompoundProcessor::NewL(MMTPDataProviderFramework& aFramework, MMTPConnection& aConnection, MMTPServiceDataProvider& aDataProvider) |
40 { |
44 { |
41 CMTPSvcCompoundProcessor* self = new (ELeave) CMTPSvcCompoundProcessor(aFramework, aConnection, aDataProvider); |
45 CMTPSvcCompoundProcessor* self = new (ELeave) CMTPSvcCompoundProcessor(aFramework, aConnection, aDataProvider); |
42 CleanupStack::PushL(self); |
46 CleanupStack::PushL(self); |
45 return self; |
49 return self; |
46 } |
50 } |
47 |
51 |
48 EXPORT_C CMTPSvcCompoundProcessor::~CMTPSvcCompoundProcessor() |
52 EXPORT_C CMTPSvcCompoundProcessor::~CMTPSvcCompoundProcessor() |
49 { |
53 { |
50 __FLOG(_L8("~CMTPSvcCompoundProcessor - Entry")); |
54 OstTraceFunctionEntry0( CMTPSVCCOMPOUNDPROCESSOR_CMTPSVCCOMPOUNDPROCESSOR_DES_ENTRY ); |
51 delete iReceivedObjectMetaData; |
55 delete iReceivedObjectMetaData; |
52 delete iObjectInfo; |
56 delete iObjectInfo; |
53 delete iObjectPropList; |
57 delete iObjectPropList; |
54 __FLOG(_L8("~CMTPSvcCompoundProcessor - Exit")); |
58 OstTraceFunctionExit0( CMTPSVCCOMPOUNDPROCESSOR_CMTPSVCCOMPOUNDPROCESSOR_DES_EXIT ); |
55 __FLOG_CLOSE; |
|
56 } |
59 } |
57 |
60 |
58 CMTPSvcCompoundProcessor::CMTPSvcCompoundProcessor(MMTPDataProviderFramework& aFramework, MMTPConnection& aConnection, MMTPServiceDataProvider& aDataProvider) : |
61 CMTPSvcCompoundProcessor::CMTPSvcCompoundProcessor(MMTPDataProviderFramework& aFramework, MMTPConnection& aConnection, MMTPServiceDataProvider& aDataProvider) : |
59 CMTPRequestProcessor(aFramework, aConnection, 0, NULL), |
62 CMTPRequestProcessor(aFramework, aConnection, 0, NULL), |
60 iDataProvider(aDataProvider), iState(EIdle), iIsCommited(EFalse), iIsRollBackHandlerObject(EFalse) |
63 iDataProvider(aDataProvider), iState(EIdle), iIsCommited(EFalse), iIsRollBackHandlerObject(EFalse) |
61 { |
64 { |
62 } |
65 } |
63 |
66 |
64 void CMTPSvcCompoundProcessor::ConstructL() |
67 void CMTPSvcCompoundProcessor::ConstructL() |
65 { |
68 { |
66 __FLOG_OPEN(KMTPSubsystem, KComponent); |
69 OstTraceFunctionEntry0( CMTPSVCCOMPOUNDPROCESSOR_CONSTRUCTL_ENTRY ); |
67 __FLOG(_L8("ConstructL - Entry")); |
|
68 iExpectedSendObjectRequest.SetUint16(TMTPTypeRequest::ERequestOperationCode, EMTPOpCodeSendObject); |
70 iExpectedSendObjectRequest.SetUint16(TMTPTypeRequest::ERequestOperationCode, EMTPOpCodeSendObject); |
69 iReceivedObjectMetaData = CMTPObjectMetaData::NewL(); |
71 iReceivedObjectMetaData = CMTPObjectMetaData::NewL(); |
70 iReceivedObjectMetaData->SetUint(CMTPObjectMetaData::EDataProviderId, iFramework.DataProviderId()); |
72 iReceivedObjectMetaData->SetUint(CMTPObjectMetaData::EDataProviderId, iFramework.DataProviderId()); |
71 __FLOG(_L8("ConstructL - Exit")); |
73 OstTraceFunctionExit0( CMTPSVCCOMPOUNDPROCESSOR_CONSTRUCTL_EXIT ); |
72 } |
74 } |
73 |
75 |
74 /** |
76 /** |
75 Override to match both the SendObjectInfo/SendObjectPropList/UpdateObjectPropList and SendObject requests |
77 Override to match both the SendObjectInfo/SendObjectPropList/UpdateObjectPropList and SendObject requests |
76 @param aRequest The request to match |
78 @param aRequest The request to match |
77 @param aConnection The connection from which the request comes |
79 @param aConnection The connection from which the request comes |
78 @return ETrue if the processor can handle the request, otherwise EFalse |
80 @return ETrue if the processor can handle the request, otherwise EFalse |
79 */ |
81 */ |
80 TBool CMTPSvcCompoundProcessor::Match(const TMTPTypeRequest& aRequest, MMTPConnection& aConnection) const |
82 TBool CMTPSvcCompoundProcessor::Match(const TMTPTypeRequest& aRequest, MMTPConnection& aConnection) const |
81 { |
83 { |
82 __FLOG(_L8("Match - Entry")); |
84 OstTraceFunctionEntry0( CMTPSVCCOMPOUNDPROCESSOR_MATCH_ENTRY ); |
83 TBool result = EFalse; |
85 TBool result = EFalse; |
84 TUint16 operationCode = aRequest.Uint16(TMTPTypeRequest::ERequestOperationCode); |
86 TUint16 operationCode = aRequest.Uint16(TMTPTypeRequest::ERequestOperationCode); |
85 if ((&iConnection == &aConnection) && |
87 if ((&iConnection == &aConnection) && |
86 (operationCode == EMTPOpCodeSendObjectInfo || |
88 (operationCode == EMTPOpCodeSendObjectInfo || |
87 operationCode == EMTPOpCodeSendObject || |
89 operationCode == EMTPOpCodeSendObject || |
88 operationCode == EMTPOpCodeUpdateObjectPropList || |
90 operationCode == EMTPOpCodeUpdateObjectPropList || |
89 operationCode == EMTPOpCodeSendObjectPropList)) |
91 operationCode == EMTPOpCodeSendObjectPropList)) |
90 { |
92 { |
91 result = ETrue; |
93 result = ETrue; |
92 } |
94 } |
93 __FLOG(_L8("Match - Exit")); |
95 OstTraceFunctionExit0( CMTPSVCCOMPOUNDPROCESSOR_MATCH_EXIT ); |
94 return result; |
96 return result; |
95 } |
97 } |
96 |
98 |
97 TBool CMTPSvcCompoundProcessor::HasDataphase() const |
99 TBool CMTPSvcCompoundProcessor::HasDataphase() const |
98 { |
100 { |
103 Verify the request |
105 Verify the request |
104 @return EMTPRespCodeOK if request is verified, otherwise one of the error response codes |
106 @return EMTPRespCodeOK if request is verified, otherwise one of the error response codes |
105 */ |
107 */ |
106 TMTPResponseCode CMTPSvcCompoundProcessor::CheckRequestL() |
108 TMTPResponseCode CMTPSvcCompoundProcessor::CheckRequestL() |
107 { |
109 { |
108 __FLOG(_L8("CheckRequestL - Entry")); |
110 OstTraceFunctionEntry0( CMTPSVCCOMPOUNDPROCESSOR_CHECKREQUESTL_ENTRY ); |
109 TMTPResponseCode responseCode = CMTPRequestProcessor::CheckRequestL(); |
111 TMTPResponseCode responseCode = CMTPRequestProcessor::CheckRequestL(); |
110 if (EMTPRespCodeOK == responseCode) |
112 if (EMTPRespCodeOK == responseCode) |
111 { |
113 { |
112 responseCode = CheckSendingStateL(); |
114 responseCode = CheckSendingStateL(); |
113 if (EMTPRespCodeOK == responseCode) |
115 if (EMTPRespCodeOK == responseCode) |
114 { |
116 { |
115 responseCode = CheckRequestParametersL(); |
117 responseCode = CheckRequestParametersL(); |
116 } |
118 } |
117 } |
119 } |
118 __FLOG_VA((_L8("CheckRequestL - Exit with code: 0x%04X"), responseCode)); |
120 |
|
121 OstTrace1( TRACE_NORMAL, CMTPSVCCOMPOUNDPROCESSOR_CHECKREQUESTL, "Exit with code: 0x%04X", responseCode); |
|
122 OstTraceFunctionExit0( CMTPSVCCOMPOUNDPROCESSOR_CHECKREQUESTL_EXIT ); |
119 return responseCode; |
123 return responseCode; |
120 } |
124 } |
121 |
125 |
122 /** |
126 /** |
123 Verify if the SendObject request comes after SendObjectInfo/SendObjectPropList request |
127 Verify if the SendObject request comes after SendObjectInfo/SendObjectPropList request |
124 @return EMTPRespCodeOK if SendObject request comes after a valid SendObjectInfo request, otherwise |
128 @return EMTPRespCodeOK if SendObject request comes after a valid SendObjectInfo request, otherwise |
125 EMTPRespCodeNoValidObjectInfo |
129 EMTPRespCodeNoValidObjectInfo |
126 */ |
130 */ |
127 TMTPResponseCode CMTPSvcCompoundProcessor::CheckSendingStateL() |
131 TMTPResponseCode CMTPSvcCompoundProcessor::CheckSendingStateL() |
128 { |
132 { |
129 __FLOG(_L8("CheckSendingStateL - Entry")); |
133 OstTraceFunctionEntry0( CMTPSVCCOMPOUNDPROCESSOR_CHECKSENDINGSTATEL_ENTRY ); |
130 TMTPResponseCode responseCode = EMTPRespCodeOK; |
134 TMTPResponseCode responseCode = EMTPRespCodeOK; |
131 iOperationCode = Request().Uint16(TMTPTypeRequest::ERequestOperationCode); |
135 iOperationCode = Request().Uint16(TMTPTypeRequest::ERequestOperationCode); |
132 |
136 |
133 if (iOperationCode == EMTPOpCodeSendObject) |
137 if (iOperationCode == EMTPOpCodeSendObject) |
134 { |
138 { |
144 case EIdle: |
148 case EIdle: |
145 // Received an orphan SendObject |
149 // Received an orphan SendObject |
146 if (iOperationCode == EMTPOpCodeSendObject) |
150 if (iOperationCode == EMTPOpCodeSendObject) |
147 { |
151 { |
148 responseCode = EMTPRespCodeNoValidObjectInfo; |
152 responseCode = EMTPRespCodeNoValidObjectInfo; |
149 __FLOG(_L8("EIdle: Received an orphan SendObject request")); |
153 OstTrace0( TRACE_NORMAL, DUP1_CMTPSVCCOMPOUNDPROCESSOR_CHECKSENDINGSTATEL, "EIdle: Received an orphan SendObject request" ); |
150 } |
154 } |
151 break; |
155 break; |
152 case EObjectInfoSucceed: |
156 case EObjectInfoSucceed: |
153 // If another SendObjectInfo or SendObjectPropList operation occurs before a SendObject |
157 // If another SendObjectInfo or SendObjectPropList operation occurs before a SendObject |
154 // operation, the new ObjectInfo or ObjectPropList shall replace the previously held one. |
158 // operation, the new ObjectInfo or ObjectPropList shall replace the previously held one. |
179 iReceivedObjectMetaData->SetUint(CMTPObjectMetaData::EDataProviderId, iFramework.DataProviderId()); |
183 iReceivedObjectMetaData->SetUint(CMTPObjectMetaData::EDataProviderId, iFramework.DataProviderId()); |
180 iObjectHandler = NULL; |
184 iObjectHandler = NULL; |
181 iState = EIdle; |
185 iState = EIdle; |
182 // Reset commit state to false |
186 // Reset commit state to false |
183 iIsCommited = EFalse; |
187 iIsCommited = EFalse; |
184 __FLOG(_L8("EObjectInfoSucceed: Receive send obj info request again, return to EIdle")); |
188 OstTrace0( TRACE_NORMAL, DUP2_CMTPSVCCOMPOUNDPROCESSOR_CHECKSENDINGSTATEL, |
|
189 "EObjectInfoSucceed: Receive send obj info request again, return to EIdle" ); |
185 } |
190 } |
186 break; |
191 break; |
187 default: |
192 default: |
|
193 OstTrace1( TRACE_ERROR, DUP3_CMTPSVCCOMPOUNDPROCESSOR_CHECKSENDINGSTATEL, "wrong iState %d", iState); |
188 User::Leave(KErrGeneral); |
194 User::Leave(KErrGeneral); |
189 } |
195 } |
190 __FLOG_VA((_L8("CheckSendingStateL - Exit with code: 0x%04X, state: %u"), responseCode, iState)); |
196 OstTraceExt2( TRACE_NORMAL, CMTPSVCCOMPOUNDPROCESSOR_CHECKSENDINGSTATEL, "Exit with code: 0x%04X, state: %u", (TUint32)responseCode, iState ); |
|
197 OstTraceFunctionExit0( CMTPSVCCOMPOUNDPROCESSOR_CHECKSENDINGSTATEL_EXIT ); |
191 return responseCode; |
198 return responseCode; |
192 } |
199 } |
193 |
200 |
194 /** |
201 /** |
195 Validates the data type for a given property code. |
202 Validates the data type for a given property code. |
196 @return EMTPRespCodeOK if the parent handle matches the store id, or another MTP response code if not |
203 @return EMTPRespCodeOK if the parent handle matches the store id, or another MTP response code if not |
197 */ |
204 */ |
198 TMTPResponseCode CMTPSvcCompoundProcessor::CheckRequestParametersL() |
205 TMTPResponseCode CMTPSvcCompoundProcessor::CheckRequestParametersL() |
199 { |
206 { |
200 __FLOG(_L8("CheckRequestParametersL - Entry")); |
207 OstTraceFunctionEntry0( CMTPSVCCOMPOUNDPROCESSOR_CHECKREQUESTPARAMETERSL_ENTRY ); |
201 TMTPResponseCode responseCode = EMTPRespCodeOK; |
208 TMTPResponseCode responseCode = EMTPRespCodeOK; |
202 |
209 |
203 switch (iOperationCode) |
210 switch (iOperationCode) |
204 { |
211 { |
205 case EMTPOpCodeSendObject: |
212 case EMTPOpCodeSendObject: |
206 { |
213 { |
207 __FLOG(_L8("Check SendObject request parameters")); |
214 OstTrace0( TRACE_NORMAL, DUP1_CMTPSVCCOMPOUNDPROCESSOR_CHECKREQUESTPARAMETERSL, |
|
215 "Check SendObject request parameters" ); |
208 // Check SendObject's session ID |
216 // Check SendObject's session ID |
209 if (iSessionId != iLastSessionID) |
217 if (iSessionId != iLastSessionID) |
210 { |
218 { |
211 responseCode = EMTPRespCodeNoValidObjectInfo; |
219 responseCode = EMTPRespCodeNoValidObjectInfo; |
212 } |
220 } |
218 break; |
226 break; |
219 } |
227 } |
220 |
228 |
221 case EMTPOpCodeSendObjectInfo: |
229 case EMTPOpCodeSendObjectInfo: |
222 { |
230 { |
223 __FLOG(_L8("Check SendObjectInfo request parameters")); |
231 OstTrace0( TRACE_NORMAL, DUP2_CMTPSVCCOMPOUNDPROCESSOR_CHECKREQUESTPARAMETERSL, |
|
232 "Check SendObjectInfo request parameters" ); |
224 responseCode = CheckStoreAndParent(); |
233 responseCode = CheckStoreAndParent(); |
225 break; |
234 break; |
226 } |
235 } |
227 |
236 |
228 case EMTPOpCodeSendObjectPropList: |
237 case EMTPOpCodeSendObjectPropList: |
229 { |
238 { |
230 __FLOG(_L8("Check SendObjectPropList request parameters")); |
239 OstTrace0( TRACE_NORMAL, DUP3_CMTPSVCCOMPOUNDPROCESSOR_CHECKREQUESTPARAMETERSL, |
|
240 "Check SendObjectPropList request parameters" ); |
231 responseCode = CheckStoreAndParent(); |
241 responseCode = CheckStoreAndParent(); |
232 if (EMTPRespCodeOK == responseCode) |
242 if (EMTPRespCodeOK == responseCode) |
233 { |
243 { |
234 // SendObjectPropList need check format code and size in the request |
244 // SendObjectPropList need check format code and size in the request |
235 TUint32 objectSizeHigh = Request().Uint32(TMTPTypeRequest::ERequestParameter4); |
245 TUint32 objectSizeHigh = Request().Uint32(TMTPTypeRequest::ERequestParameter4); |
278 default: |
289 default: |
279 // Unexpected operation code |
290 // Unexpected operation code |
280 responseCode = EMTPRespCodeOperationNotSupported; |
291 responseCode = EMTPRespCodeOperationNotSupported; |
281 break; |
292 break; |
282 } |
293 } |
283 __FLOG_VA((_L8("CheckRequestParametersL exit with code: 0x%x"), responseCode)); |
294 OstTrace1( TRACE_NORMAL, CMTPSVCCOMPOUNDPROCESSOR_CHECKREQUESTPARAMETERSL, "exit with code: 0x%x", responseCode ); |
|
295 OstTraceFunctionExit0( CMTPSVCCOMPOUNDPROCESSOR_CHECKREQUESTPARAMETERSL_EXIT ); |
284 return responseCode; |
296 return responseCode; |
285 } |
297 } |
286 |
298 |
287 /** |
299 /** |
288 Validates the data type for a given property code. |
300 Validates the data type for a given property code. |
289 @return EMTPRespCodeOK if the parent handle matches the store id, or another MTP response code if not |
301 @return EMTPRespCodeOK if the parent handle matches the store id, or another MTP response code if not |
290 */ |
302 */ |
291 TMTPResponseCode CMTPSvcCompoundProcessor::CheckStoreAndParent() |
303 TMTPResponseCode CMTPSvcCompoundProcessor::CheckStoreAndParent() |
292 { |
304 { |
293 __FLOG(_L8("CheckStoreAndParent - Entry")); |
305 OstTraceFunctionEntry0( CMTPSVCCOMPOUNDPROCESSOR_CHECKSTOREANDPARENT_ENTRY ); |
294 TMTPResponseCode responseCode = EMTPRespCodeOK; |
306 TMTPResponseCode responseCode = EMTPRespCodeOK; |
295 iStorageId = Request().Uint32(TMTPTypeRequest::ERequestParameter1); |
307 iStorageId = Request().Uint32(TMTPTypeRequest::ERequestParameter1); |
296 iParentHandle = Request().Uint32(TMTPTypeRequest::ERequestParameter2); |
308 iParentHandle = Request().Uint32(TMTPTypeRequest::ERequestParameter2); |
297 |
309 |
298 // If the first parameter is unused, it should be set to 0x00000000, and the responder should decide |
310 // If the first parameter is unused, it should be set to 0x00000000, and the responder should decide |
318 { |
330 { |
319 responseCode = EMTPRespCodeInvalidStorageID; |
331 responseCode = EMTPRespCodeInvalidStorageID; |
320 } |
332 } |
321 } |
333 } |
322 |
334 |
323 __FLOG_VA((_L8("CheckStoreAndParent - Exit with code: 0x%x"), responseCode)); |
335 OstTrace1( TRACE_NORMAL, CMTPSVCCOMPOUNDPROCESSOR_CHECKSTOREANDPARENT, "Exit with code: 0x%x", responseCode ); |
|
336 OstTraceFunctionExit0( CMTPSVCCOMPOUNDPROCESSOR_CHECKSTOREANDPARENT_EXIT ); |
324 return responseCode; |
337 return responseCode; |
325 } |
338 } |
326 |
339 |
327 /** |
340 /** |
328 SendObjectInfo/SendObjectPropList/UpdateObjectPropList/SendObject request handler |
341 SendObjectInfo/SendObjectPropList/UpdateObjectPropList/SendObject request handler |
329 To maintain the state information between the two requests, the two requests are |
342 To maintain the state information between the two requests, the two requests are |
330 combined together in one request processor. |
343 combined together in one request processor. |
331 */ |
344 */ |
332 void CMTPSvcCompoundProcessor::ServiceL() |
345 void CMTPSvcCompoundProcessor::ServiceL() |
333 { |
346 { |
334 __FLOG(_L8("ServiceL - Entry")); |
347 OstTraceFunctionEntry0( CMTPSVCCOMPOUNDPROCESSOR_SERVICEL_ENTRY ); |
335 switch (iState) |
348 switch (iState) |
336 { |
349 { |
337 case EIdle: |
350 case EIdle: |
338 ServiceObjectPropertiesL(); |
351 ServiceObjectPropertiesL(); |
339 break; |
352 break; |
340 case EObjectInfoSucceed: |
353 case EObjectInfoSucceed: |
341 ServiceSendObjectL(); |
354 ServiceSendObjectL(); |
342 break; |
355 break; |
343 default: |
356 default: |
344 __FLOG(_L8("Wrong state in ServiceL")); |
357 OstTrace0( TRACE_WARNING, CMTPSVCCOMPOUNDPROCESSOR_SERVICEL, "Wrong state in ServiceL" ); |
345 break; |
358 break; |
346 } |
359 } |
347 __FLOG(_L8("ServiceL - Exit")); |
360 OstTraceFunctionExit0( CMTPSVCCOMPOUNDPROCESSOR_SERVICEL_EXIT ); |
348 } |
361 } |
349 |
362 |
350 void CMTPSvcCompoundProcessor::ServiceObjectPropertiesL() |
363 void CMTPSvcCompoundProcessor::ServiceObjectPropertiesL() |
351 { |
364 { |
352 __FLOG(_L8("ServiceObjectPropertiesL - Entry")); |
365 OstTraceFunctionEntry0( CMTPSVCCOMPOUNDPROCESSOR_SERVICEOBJECTPROPERTIESL_ENTRY ); |
353 switch (iOperationCode) |
366 switch (iOperationCode) |
354 { |
367 { |
355 case EMTPOpCodeSendObjectInfo: |
368 case EMTPOpCodeSendObjectInfo: |
356 ServiceSendObjectInfoL(); |
369 ServiceSendObjectInfoL(); |
357 break; |
370 break; |
361 ServiceSendObjectPropListL(); |
374 ServiceSendObjectPropListL(); |
362 break; |
375 break; |
363 default: |
376 default: |
364 break; |
377 break; |
365 } |
378 } |
366 __FLOG(_L8("ServiceObjectPropertiesL - Exit")); |
379 OstTraceFunctionExit0( CMTPSVCCOMPOUNDPROCESSOR_SERVICEOBJECTPROPERTIESL_EXIT ); |
367 } |
380 } |
368 |
381 |
369 /** |
382 /** |
370 SendObject request handler |
383 SendObject request handler |
371 */ |
384 */ |
372 void CMTPSvcCompoundProcessor::ServiceSendObjectL() |
385 void CMTPSvcCompoundProcessor::ServiceSendObjectL() |
373 { |
386 { |
374 __FLOG(_L8("ServiceSendObjectL - Entry")); |
387 OstTraceFunctionEntry0( CMTPSVCCOMPOUNDPROCESSOR_SERVICESENDOBJECTL_ENTRY ); |
375 MMTPSvcObjectHandler* pHandler = iDataProvider.ObjectHandler(iFormatCode); |
388 MMTPSvcObjectHandler* pHandler = iDataProvider.ObjectHandler(iFormatCode); |
376 if (pHandler) |
389 if (pHandler) |
377 { |
390 { |
378 pHandler->GetBufferForSendObjectL(*iReceivedObjectMetaData, &iObjectContent); |
391 pHandler->GetBufferForSendObjectL(*iReceivedObjectMetaData, &iObjectContent); |
379 } |
392 } |
380 else |
393 else |
381 { |
394 { |
|
395 OstTrace1( TRACE_ERROR, CMTPSVCCOMPOUNDPROCESSOR_SERVICESENDOBJECTL, |
|
396 "can't get object handler for format code %d", iFormatCode); |
382 User::Leave(KErrGeneral); |
397 User::Leave(KErrGeneral); |
383 } |
398 } |
384 ReceiveDataL(*iObjectContent); |
399 ReceiveDataL(*iObjectContent); |
385 iState = EObjectSendProcessing; |
400 iState = EObjectSendProcessing; |
386 __FLOG(_L8("ServiceSendObjectL - Exit")); |
401 OstTraceFunctionExit0( CMTPSVCCOMPOUNDPROCESSOR_SERVICESENDOBJECTL_EXIT ); |
387 } |
402 } |
388 |
403 |
389 /** |
404 /** |
390 SendObjectInfo request handler |
405 SendObjectInfo request handler |
391 */ |
406 */ |
392 void CMTPSvcCompoundProcessor::ServiceSendObjectInfoL() |
407 void CMTPSvcCompoundProcessor::ServiceSendObjectInfoL() |
393 { |
408 { |
394 __FLOG(_L8("ServiceSendObjectInfoL - Entry")); |
409 OstTraceFunctionEntry0( CMTPSVCCOMPOUNDPROCESSOR_SERVICESENDOBJECTINFOL_ENTRY ); |
395 delete iObjectInfo; |
410 delete iObjectInfo; |
396 iObjectInfo = NULL; |
411 iObjectInfo = NULL; |
397 iObjectInfo = CMTPTypeObjectInfo::NewL(); |
412 iObjectInfo = CMTPTypeObjectInfo::NewL(); |
398 ReceiveDataL(*iObjectInfo); |
413 ReceiveDataL(*iObjectInfo); |
399 iState = EObjectInfoProcessing; |
414 iState = EObjectInfoProcessing; |
400 __FLOG(_L8("ServiceSendObjectInfoL - Exit")); |
415 OstTraceFunctionExit0( CMTPSVCCOMPOUNDPROCESSOR_SERVICESENDOBJECTINFOL_EXIT ); |
401 } |
416 } |
402 |
417 |
403 /** |
418 /** |
404 SendObjectPropList request handler |
419 SendObjectPropList request handler |
405 */ |
420 */ |
406 void CMTPSvcCompoundProcessor::ServiceSendObjectPropListL() |
421 void CMTPSvcCompoundProcessor::ServiceSendObjectPropListL() |
407 { |
422 { |
408 __FLOG(_L8("ServiceSendObjectPropListL - Entry")); |
423 OstTraceFunctionEntry0( CMTPSVCCOMPOUNDPROCESSOR_SERVICESENDOBJECTPROPLISTL_ENTRY ); |
409 delete iObjectPropList; |
424 delete iObjectPropList; |
410 iObjectPropList = NULL; |
425 iObjectPropList = NULL; |
411 iObjectPropList = CMTPTypeObjectPropList::NewL(); |
426 iObjectPropList = CMTPTypeObjectPropList::NewL(); |
412 ReceiveDataL(*iObjectPropList); |
427 ReceiveDataL(*iObjectPropList); |
413 iState = EObjectInfoProcessing; |
428 iState = EObjectInfoProcessing; |
414 __FLOG(_L8("ServiceSendObjectPropListL - Exit")); |
429 OstTraceFunctionExit0( CMTPSVCCOMPOUNDPROCESSOR_SERVICESENDOBJECTPROPLISTL_EXIT ); |
415 } |
430 } |
416 |
431 |
417 /** |
432 /** |
418 Override to handle the response phase of SendObjectInfo/SendObjectPropList and SendObject requests |
433 Override to handle the response phase of SendObjectInfo/SendObjectPropList and SendObject requests |
419 @return EFalse |
434 @return EFalse |
420 */ |
435 */ |
421 TBool CMTPSvcCompoundProcessor::DoHandleResponsePhaseL() |
436 TBool CMTPSvcCompoundProcessor::DoHandleResponsePhaseL() |
422 { |
437 { |
423 __FLOG(_L8("DoHandleResponsePhaseL - Entry")); |
438 OstTraceFunctionEntry0( CMTPSVCCOMPOUNDPROCESSOR_DOHANDLERESPONSEPHASEL_ENTRY ); |
424 TBool successful = !iCancelled; |
439 TBool successful = !iCancelled; |
425 switch (iState) |
440 switch (iState) |
426 { |
441 { |
427 case EObjectInfoProcessing: |
442 case EObjectInfoProcessing: |
428 { |
443 { |
447 iState = (successful ? EObjectSendSucceed : EObjectSendFail); |
462 iState = (successful ? EObjectSendSucceed : EObjectSendFail); |
448 break; |
463 break; |
449 } |
464 } |
450 default: |
465 default: |
451 // Wrong State value. |
466 // Wrong State value. |
452 __FLOG_VA((_L8("DoHandleResponsePhaseL enter an abnormal state %d"), iState)); |
467 OstTrace1( TRACE_WARNING, CMTPSVCCOMPOUNDPROCESSOR_DOHANDLERESPONSEPHASEL, |
453 break; |
468 "DoHandleResponsePhaseL enter an abnormal state %d", iState ); |
454 } |
469 break; |
455 __FLOG(_L8("DoHandleResponsePhaseL - Exit")); |
470 } |
|
471 OstTraceFunctionExit0( CMTPSVCCOMPOUNDPROCESSOR_DOHANDLERESPONSEPHASEL_EXIT ); |
456 return EFalse; |
472 return EFalse; |
457 } |
473 } |
458 |
474 |
459 /** |
475 /** |
460 Override to handle the completing phase of SendObjectInfo/SendObjectPropList and SendObject requests |
476 Override to handle the completing phase of SendObjectInfo/SendObjectPropList and SendObject requests |
461 @return ETrue if succesfully received the object content, otherwise EFalse |
477 @return ETrue if succesfully received the object content, otherwise EFalse |
462 */ |
478 */ |
463 TBool CMTPSvcCompoundProcessor::DoHandleCompletingPhaseL() |
479 TBool CMTPSvcCompoundProcessor::DoHandleCompletingPhaseL() |
464 { |
480 { |
465 __FLOG(_L8("DoHandleCompletingPhaseL - Entry")); |
481 OstTraceFunctionEntry0( CMTPSVCCOMPOUNDPROCESSOR_DOHANDLECOMPLETINGPHASEL_ENTRY ); |
466 TBool result = ETrue; |
482 TBool result = ETrue; |
467 CMTPRequestProcessor::DoHandleCompletingPhaseL(); |
483 CMTPRequestProcessor::DoHandleCompletingPhaseL(); |
468 |
484 |
469 __FLOG_VA((_L8("DoHandleCompletingPhaseL - Progress State: %u"), iState)); |
485 OstTrace1( TRACE_WARNING, CMTPSVCCOMPOUNDPROCESSOR_DOHANDLECOMPLETINGPHASEL, |
|
486 "DoHandleCompletingPhaseL - Progress State: %u", iState ); |
470 switch (iState) |
487 switch (iState) |
471 { |
488 { |
472 case EObjectInfoSucceed: |
489 case EObjectInfoSucceed: |
473 { |
490 { |
474 // Two cases will come here: |
491 // Two cases will come here: |
483 iLastTransactionID = iTransactionCode; |
500 iLastTransactionID = iTransactionCode; |
484 iLastSessionID = iSessionId; |
501 iLastSessionID = iSessionId; |
485 iLastInfoOperationCode = iOperationCode; |
502 iLastInfoOperationCode = iOperationCode; |
486 } |
503 } |
487 result = EFalse; |
504 result = EFalse; |
488 __FLOG_VA((_L8("EObjectInfoSucceed: Save send info transaction id: %u, operation: 0x%x"), iLastTransactionID, iOperationCode)); |
505 OstTraceExt2( TRACE_NORMAL, DUP1_CMTPSVCCOMPOUNDPROCESSOR_DOHANDLECOMPLETINGPHASEL, |
|
506 "EObjectInfoSucceed: Save send info transaction id: %u, operation: 0x%x", iLastTransactionID, iOperationCode ); |
|
507 |
489 break; |
508 break; |
490 } |
509 } |
491 case EObjectSendFail: |
510 case EObjectSendFail: |
492 { |
511 { |
493 // When process SendObject fail, such as received size is wrong. |
512 // When process SendObject fail, such as received size is wrong. |
502 // 2. Framework error and call complete with error state. |
521 // 2. Framework error and call complete with error state. |
503 // 3. SendObjInfo fail |
522 // 3. SendObjInfo fail |
504 // 4. First request is orphan SendObject, state is Idle |
523 // 4. First request is orphan SendObject, state is Idle |
505 break; |
524 break; |
506 } |
525 } |
507 __FLOG(_L8("DoHandleCompletingPhaseL - Exit")); |
526 OstTraceFunctionExit0( CMTPSVCCOMPOUNDPROCESSOR_DOHANDLECOMPLETINGPHASEL_EXIT ); |
508 return result; |
527 return result; |
509 } |
528 } |
510 |
529 |
511 /** |
530 /** |
512 Handling the completing phase of SendObjectInfo request |
531 Handling the completing phase of SendObjectInfo request |
513 @return ETrue if the specified object can be saved on the specified location, otherwise, EFalse |
532 @return ETrue if the specified object can be saved on the specified location, otherwise, EFalse |
514 */ |
533 */ |
515 TBool CMTPSvcCompoundProcessor::DoHandleResponseSendObjectInfoL() |
534 TBool CMTPSvcCompoundProcessor::DoHandleResponseSendObjectInfoL() |
516 { |
535 { |
517 __FLOG(_L8("DoHandleResponseSendObjectInfoL - Entry")); |
536 OstTraceFunctionEntry0( CMTPSVCCOMPOUNDPROCESSOR_DOHANDLERESPONSESENDOBJECTINFOL_ENTRY ); |
518 TMTPResponseCode responseCode = EMTPRespCodeOK; |
537 TMTPResponseCode responseCode = EMTPRespCodeOK; |
519 TBool result(ETrue); |
538 TBool result(ETrue); |
520 iFormatCode = iObjectInfo->Uint16L(CMTPTypeObjectInfo::EObjectFormat); |
539 iFormatCode = iObjectInfo->Uint16L(CMTPTypeObjectInfo::EObjectFormat); |
521 // Check format code and set object handler |
540 // Check format code and set object handler |
522 responseCode = CheckFmtAndSetHandler(iFormatCode); |
541 responseCode = CheckFmtAndSetHandler(iFormatCode); |
539 else |
558 else |
540 { |
559 { |
541 //if object size is zero, then directly store object without waiting for sendobject operation. |
560 //if object size is zero, then directly store object without waiting for sendobject operation. |
542 if (iObjectSize == 0) |
561 if (iObjectSize == 0) |
543 { |
562 { |
544 __FLOG(_L8("CommitReservedObject because object size is 0 and register for SendObject")); |
563 OstTrace0( TRACE_NORMAL, DUP1_CMTPSVCCOMPOUNDPROCESSOR_DOHANDLERESPONSESENDOBJECTINFOL, |
|
564 "CommitReservedObject because object size is 0 and register for SendObject" ); |
545 // Commit new temp object to object mgr, if leave, CleanupStack will rollback new temp object. |
565 // Commit new temp object to object mgr, if leave, CleanupStack will rollback new temp object. |
546 TCleanupItem rollBackTempObject(RollBackObject, this); |
566 TCleanupItem rollBackTempObject(RollBackObject, this); |
547 CleanupStack::PushL(rollBackTempObject); |
567 CleanupStack::PushL(rollBackTempObject); |
548 // Commit prop to obj mgr |
568 // Commit prop to obj mgr |
549 iObjectHandler->CommitForNewObjectL(suid); |
569 iObjectHandler->CommitForNewObjectL(suid); |
574 RegisterRequestAndSendResponseL(responseCode); |
594 RegisterRequestAndSendResponseL(responseCode); |
575 } |
595 } |
576 } |
596 } |
577 } |
597 } |
578 result = (responseCode == EMTPRespCodeOK) ? ETrue : EFalse; |
598 result = (responseCode == EMTPRespCodeOK) ? ETrue : EFalse; |
579 __FLOG_VA((_L8("DoHandleResponseSendObjectInfoL exit with code: 0x%x"), responseCode)); |
599 OstTrace1( TRACE_NORMAL, CMTPSVCCOMPOUNDPROCESSOR_DOHANDLERESPONSESENDOBJECTINFOL, "exit with code: 0x%x", responseCode); |
|
600 OstTraceFunctionExit0( CMTPSVCCOMPOUNDPROCESSOR_DOHANDLERESPONSESENDOBJECTINFOL_EXIT ); |
580 return result; |
601 return result; |
581 } |
602 } |
582 |
603 |
583 /** |
604 /** |
584 Handling the completing phase of SendObjectPropList request |
605 Handling the completing phase of SendObjectPropList request |
585 @return ETrue if the specified object can be saved on the specified location, otherwise, EFalse |
606 @return ETrue if the specified object can be saved on the specified location, otherwise, EFalse |
586 */ |
607 */ |
587 TBool CMTPSvcCompoundProcessor::DoHandleResponseSendObjectPropListL() |
608 TBool CMTPSvcCompoundProcessor::DoHandleResponseSendObjectPropListL() |
588 { |
609 { |
589 __FLOG(_L8("DoHandleResponseSendObjectPropListL - Entry")); |
610 OstTraceFunctionEntry0( CMTPSVCCOMPOUNDPROCESSOR_DOHANDLERESPONSESENDOBJECTPROPLISTL_ENTRY ); |
590 TBool result = ETrue; |
611 TBool result = ETrue; |
591 TMTPResponseCode responseCode = EMTPRespCodeOK; |
612 TMTPResponseCode responseCode = EMTPRespCodeOK; |
592 |
613 |
593 TBuf<KMaxSUIDLength> suid; |
614 TBuf<KMaxSUIDLength> suid; |
594 TUint32 parameter = 0; |
615 TUint32 parameter = 0; |
600 else |
621 else |
601 { |
622 { |
602 //if object size is zero, then directly store object without waiting for sendobject operation. |
623 //if object size is zero, then directly store object without waiting for sendobject operation. |
603 if (iObjectSize == 0) |
624 if (iObjectSize == 0) |
604 { |
625 { |
605 __FLOG(_L8("CommitReservedObject because object size is 0 and register for SendObject")); |
626 OstTrace0( TRACE_NORMAL, DUP1_CMTPSVCCOMPOUNDPROCESSOR_DOHANDLERESPONSESENDOBJECTPROPLISTL, |
|
627 "CommitReservedObject because object size is 0 and register for SendObject" ); |
606 // Commit new temp object to object mgr, if leave, CleanupStack will rollback new temp object. |
628 // Commit new temp object to object mgr, if leave, CleanupStack will rollback new temp object. |
607 TCleanupItem rollBackTempObject(RollBackObject, this); |
629 TCleanupItem rollBackTempObject(RollBackObject, this); |
608 CleanupStack::PushL(rollBackTempObject); |
630 CleanupStack::PushL(rollBackTempObject); |
609 // Commit prop to obj mgr |
631 // Commit prop to obj mgr |
610 iObjectHandler->CommitForNewObjectL(suid); |
632 iObjectHandler->CommitForNewObjectL(suid); |
635 RegisterRequestAndSendResponseL(responseCode); |
657 RegisterRequestAndSendResponseL(responseCode); |
636 } |
658 } |
637 } |
659 } |
638 |
660 |
639 result = (responseCode == EMTPRespCodeOK) ? ETrue : EFalse; |
661 result = (responseCode == EMTPRespCodeOK) ? ETrue : EFalse; |
640 __FLOG_VA((_L8("DoHandleResponseSendObjectPropListL exit with code = 0x%x"), responseCode)); |
662 OstTrace1( TRACE_NORMAL, CMTPSVCCOMPOUNDPROCESSOR_DOHANDLERESPONSESENDOBJECTPROPLISTL, "exit with code = 0x%x", responseCode ); |
|
663 OstTraceFunctionExit0( CMTPSVCCOMPOUNDPROCESSOR_DOHANDLERESPONSESENDOBJECTPROPLISTL_EXIT ); |
641 return result; |
664 return result; |
642 } |
665 } |
643 |
666 |
644 /** |
667 /** |
645 Handling the completing phase of UpdateObjectPropList request |
668 Handling the completing phase of UpdateObjectPropList request |
646 @return ETrue if the specified object can be saved on the specified location, otherwise, EFalse |
669 @return ETrue if the specified object can be saved on the specified location, otherwise, EFalse |
647 */ |
670 */ |
648 TBool CMTPSvcCompoundProcessor::DoHandleResponseUpdateObjectPropListL() |
671 TBool CMTPSvcCompoundProcessor::DoHandleResponseUpdateObjectPropListL() |
649 { |
672 { |
650 __FLOG(_L8("DoHandleResponseUpdateObjectPropListL - Entry")); |
673 OstTraceFunctionEntry0( CMTPSVCCOMPOUNDPROCESSOR_DOHANDLERESPONSEUPDATEOBJECTPROPLISTL_ENTRY ); |
651 TBool result = ETrue; |
674 TBool result = ETrue; |
652 TUint32 parameter = 0; |
675 TUint32 parameter = 0; |
653 TMTPResponseCode responseCode = EMTPRespCodeOK; |
676 TMTPResponseCode responseCode = EMTPRespCodeOK; |
654 // Check object size property with format |
677 // Check object size property with format |
655 responseCode = ExtractObjectSizeL(); |
678 responseCode = ExtractObjectSizeL(); |
680 iFramework.RouteRequestRegisterL(iExpectedSendObjectRequest, iConnection); |
703 iFramework.RouteRequestRegisterL(iExpectedSendObjectRequest, iConnection); |
681 } |
704 } |
682 } |
705 } |
683 SendResponseL(responseCode, 1, ¶meter); |
706 SendResponseL(responseCode, 1, ¶meter); |
684 result = (responseCode == EMTPRespCodeOK) ? ETrue: EFalse; |
707 result = (responseCode == EMTPRespCodeOK) ? ETrue: EFalse; |
685 __FLOG_VA((_L8("DoHandleResponseUpdateObjectPropListL exit with code: 0x%x"), responseCode)); |
708 OstTrace1( TRACE_NORMAL, CMTPSVCCOMPOUNDPROCESSOR_DOHANDLERESPONSEUPDATEOBJECTPROPLISTL, "exit with code: 0x%x", responseCode ); |
|
709 OstTraceFunctionExit0( CMTPSVCCOMPOUNDPROCESSOR_DOHANDLERESPONSEUPDATEOBJECTPROPLISTL_EXIT ); |
686 return result; |
710 return result; |
687 } |
711 } |
688 |
712 |
689 /** |
713 /** |
690 Handling the completing phase of SendObject request |
714 Handling the completing phase of SendObject request |
691 @return ETrue if the object has been successfully saved on the device, otherwise, EFalse |
715 @return ETrue if the object has been successfully saved on the device, otherwise, EFalse |
692 */ |
716 */ |
693 TBool CMTPSvcCompoundProcessor::DoHandleResponseSendObjectL() |
717 TBool CMTPSvcCompoundProcessor::DoHandleResponseSendObjectL() |
694 { |
718 { |
695 __FLOG(_L8("DoHandleResponseSendObjectL - Entry")); |
719 OstTraceFunctionEntry0( CMTPSVCCOMPOUNDPROCESSOR_DOHANDLERESPONSESENDOBJECTL_ENTRY ); |
696 TMTPResponseCode responseCode = EMTPRespCodeOK; |
720 TMTPResponseCode responseCode = EMTPRespCodeOK; |
697 TBool result = ETrue; |
721 TBool result = ETrue; |
698 |
722 |
699 if (iCancelled) |
723 if (iCancelled) |
700 { |
724 { |
765 result = (responseCode == EMTPRespCodeOK || responseCode == EMTPRespCodeTransactionCancelled) ? ETrue : EFalse; |
789 result = (responseCode == EMTPRespCodeOK || responseCode == EMTPRespCodeTransactionCancelled) ? ETrue : EFalse; |
766 if (result) |
790 if (result) |
767 { |
791 { |
768 iFramework.RouteRequestUnregisterL(iExpectedSendObjectRequest, iConnection); |
792 iFramework.RouteRequestUnregisterL(iExpectedSendObjectRequest, iConnection); |
769 } |
793 } |
770 __FLOG_VA((_L8("DoHandleResponseSendObjectL exit with code = 0x%x"), responseCode)); |
794 OstTrace1( TRACE_NORMAL, CMTPSVCCOMPOUNDPROCESSOR_DOHANDLERESPONSESENDOBJECTL, "exit with code = 0x%x", responseCode ); |
|
795 OstTraceFunctionExit0( CMTPSVCCOMPOUNDPROCESSOR_DOHANDLERESPONSESENDOBJECTL_EXIT ); |
|
796 |
771 return result; |
797 return result; |
772 } |
798 } |
773 |
799 |
774 TMTPResponseCode CMTPSvcCompoundProcessor::ExtractObjectSizeL() |
800 TMTPResponseCode CMTPSvcCompoundProcessor::ExtractObjectSizeL() |
775 { |
801 { |
776 __FLOG(_L8("ExtractObjectSizeL - Entry")); |
802 OstTraceFunctionEntry0( CMTPSVCCOMPOUNDPROCESSOR_EXTRACTOBJECTSIZEL_ENTRY ); |
777 TMTPResponseCode responseCode = EMTPRespCodeOK; |
803 TMTPResponseCode responseCode = EMTPRespCodeOK; |
778 TBool foundSizeProp = EFalse; |
804 TBool foundSizeProp = EFalse; |
779 const TUint KCount(iObjectPropList->NumberOfElements()); |
805 const TUint KCount(iObjectPropList->NumberOfElements()); |
780 iObjectPropList->ResetCursor(); |
806 iObjectPropList->ResetCursor(); |
781 for (TUint i = 0; i < KCount; i++) |
807 for (TUint i = 0; i < KCount; i++) |
798 { |
824 { |
799 responseCode = EMTPRespCodeGeneralError; |
825 responseCode = EMTPRespCodeGeneralError; |
800 } |
826 } |
801 } |
827 } |
802 |
828 |
803 __FLOG(_L8("ExtractObjectSizeL - Exit")); |
829 OstTraceFunctionExit0( CMTPSVCCOMPOUNDPROCESSOR_EXTRACTOBJECTSIZEL_EXIT ); |
804 return responseCode; |
830 return responseCode; |
805 } |
831 } |
806 |
832 |
807 /** |
833 /** |
808 Reserves space for and assigns an object handle to the received object, then |
834 Reserves space for and assigns an object handle to the received object, then |
809 sends a success response. |
835 sends a success response. |
810 */ |
836 */ |
811 void CMTPSvcCompoundProcessor::ReserveObjectL() |
837 void CMTPSvcCompoundProcessor::ReserveObjectL() |
812 { |
838 { |
813 __FLOG(_L8("ReserveObjectL - Entry")); |
839 OstTraceFunctionEntry0( CMTPSVCCOMPOUNDPROCESSOR_RESERVEOBJECTL_ENTRY ); |
814 iReceivedObjectMetaData->SetUint(CMTPObjectMetaData::EStorageId, iStorageId); |
840 iReceivedObjectMetaData->SetUint(CMTPObjectMetaData::EStorageId, iStorageId); |
815 iReceivedObjectMetaData->SetUint(CMTPObjectMetaData::EParentHandle, iParentHandle); |
841 iReceivedObjectMetaData->SetUint(CMTPObjectMetaData::EParentHandle, iParentHandle); |
816 iReceivedObjectMetaData->SetUint(CMTPObjectMetaData::EFormatCode, iFormatCode); |
842 iReceivedObjectMetaData->SetUint(CMTPObjectMetaData::EFormatCode, iFormatCode); |
817 iFramework.ObjectMgr().ReserveObjectHandleL(*iReceivedObjectMetaData, iObjectSize); |
843 iFramework.ObjectMgr().ReserveObjectHandleL(*iReceivedObjectMetaData, iObjectSize); |
818 __FLOG_VA((_L8("ReserveObjectL Exit Storage:%u, ParentHandle:%u, FormatCode:%u, Size:%u "), iStorageId, iParentHandle, iFormatCode, iObjectSize)); |
844 OstTraceExt4( TRACE_NORMAL, CMTPSVCCOMPOUNDPROCESSOR_RESERVEOBJECTL, "Exit Storage:%u, ParentHandle:%u, FormatCode:%u, Size:%u", iStorageId, iParentHandle, iFormatCode, iObjectSize ); |
|
845 OstTraceFunctionExit0( CMTPSVCCOMPOUNDPROCESSOR_RESERVEOBJECTL_EXIT ); |
819 } |
846 } |
820 |
847 |
821 void CMTPSvcCompoundProcessor::RegisterRequestAndSendResponseL(TMTPResponseCode aResponseCode) |
848 void CMTPSvcCompoundProcessor::RegisterRequestAndSendResponseL(TMTPResponseCode aResponseCode) |
822 { |
849 { |
823 __FLOG(_L8("RegisterRequestAndSendResponseL - Entry")); |
850 OstTraceFunctionEntry0( CMTPSVCCOMPOUNDPROCESSOR_REGISTERREQUESTANDSENDRESPONSEL_ENTRY ); |
824 // Register to framework for handle the next sendobj request |
851 // Register to framework for handle the next sendobj request |
825 iExpectedSendObjectRequest.SetUint32(TMTPTypeRequest::ERequestSessionID, iSessionId); |
852 iExpectedSendObjectRequest.SetUint32(TMTPTypeRequest::ERequestSessionID, iSessionId); |
826 iFramework.RouteRequestRegisterL(iExpectedSendObjectRequest, iConnection); |
853 iFramework.RouteRequestRegisterL(iExpectedSendObjectRequest, iConnection); |
827 TUint32 parameters[3]; |
854 TUint32 parameters[3]; |
828 parameters[0] = iStorageId; |
855 parameters[0] = iStorageId; |
829 parameters[1] = iParentHandle; |
856 parameters[1] = iParentHandle; |
830 // Responder’s reserved ObjectHandle for the incoming object |
857 // Responder’s reserved ObjectHandle for the incoming object |
831 parameters[2] = iReceivedObjectMetaData->Uint(CMTPObjectMetaData::EHandle); |
858 parameters[2] = iReceivedObjectMetaData->Uint(CMTPObjectMetaData::EHandle); |
832 SendResponseL(aResponseCode, 3, parameters); |
859 SendResponseL(aResponseCode, 3, parameters); |
833 __FLOG(_L8("RegisterRequestAndSendResponseL - Exit")); |
860 OstTraceFunctionExit0( CMTPSVCCOMPOUNDPROCESSOR_REGISTERREQUESTANDSENDRESPONSEL_EXIT ); |
834 } |
861 } |
835 |
862 |
836 void CMTPSvcCompoundProcessor::RollBackObject(TAny* aObject) |
863 void CMTPSvcCompoundProcessor::RollBackObject(TAny* aObject) |
837 { |
864 { |
838 reinterpret_cast<CMTPSvcCompoundProcessor*>(aObject)->RollBack(); |
865 reinterpret_cast<CMTPSvcCompoundProcessor*>(aObject)->RollBack(); |
848 } |
875 } |
849 } |
876 } |
850 |
877 |
851 TMTPResponseCode CMTPSvcCompoundProcessor::CheckFmtAndSetHandler(TUint32 aFormatCode) |
878 TMTPResponseCode CMTPSvcCompoundProcessor::CheckFmtAndSetHandler(TUint32 aFormatCode) |
852 { |
879 { |
853 __FLOG(_L8("CheckFmtAndSetHandler - Entry")); |
880 OstTraceFunctionEntry0( CMTPSVCCOMPOUNDPROCESSOR_CHECKFMTANDSETHANDLER_ENTRY ); |
854 TMTPResponseCode responseCode = EMTPRespCodeOK; |
881 TMTPResponseCode responseCode = EMTPRespCodeOK; |
855 iObjectHandler = iDataProvider.ObjectHandler(aFormatCode); |
882 iObjectHandler = iDataProvider.ObjectHandler(aFormatCode); |
856 if (!iObjectHandler) |
883 if (!iObjectHandler) |
857 { |
884 { |
858 responseCode = EMTPRespCodeInvalidObjectFormatCode; |
885 responseCode = EMTPRespCodeInvalidObjectFormatCode; |
859 } |
886 } |
860 __FLOG(_L8("CheckFmtAndSetHandler - Exit")); |
887 OstTraceFunctionExit0( CMTPSVCCOMPOUNDPROCESSOR_CHECKFMTANDSETHANDLER_EXIT ); |
861 return responseCode; |
888 return responseCode; |
862 } |
889 } |
863 |
890 |
864 TMTPResponseCode CMTPSvcCompoundProcessor::SendObjectPropListL(const CMTPTypeObjectPropList& aObjectPropList, TUint32& aParentHandle, |
891 TMTPResponseCode CMTPSvcCompoundProcessor::SendObjectPropListL(const CMTPTypeObjectPropList& aObjectPropList, TUint32& aParentHandle, |
865 TUint32& aParameter, TDes& aSuid, TUint64 aObjectSize) |
892 TUint32& aParameter, TDes& aSuid, TUint64 aObjectSize) |
866 { |
893 { |
867 __FLOG(_L8("SendObjectPropListL - Entry")); |
894 OstTraceFunctionEntry0( CMTPSVCCOMPOUNDPROCESSOR_SENDOBJECTPROPLISTL_ENTRY ); |
868 TMTPResponseCode responseCode = EMTPRespCodeOK; |
895 TMTPResponseCode responseCode = EMTPRespCodeOK; |
869 aParameter = 0; |
896 aParameter = 0; |
870 |
897 |
871 responseCode = iObjectHandler->SendObjectPropListL(aObjectSize, aObjectPropList, aParentHandle, aSuid); |
898 responseCode = iObjectHandler->SendObjectPropListL(aObjectSize, aObjectPropList, aParentHandle, aSuid); |
872 // If handler cache an entry in SendObjectPropList, then it should never return error code. Processor will |
899 // If handler cache an entry in SendObjectPropList, then it should never return error code. Processor will |
903 if (EMTPRespCodeOK != responseCode) |
930 if (EMTPRespCodeOK != responseCode) |
904 { |
931 { |
905 iObjectHandler->RollBack(); |
932 iObjectHandler->RollBack(); |
906 } |
933 } |
907 } |
934 } |
908 __FLOG_VA((_L8("SendObjectPropListL - Exit with responseCode = 0x%04X"), responseCode)); |
935 OstTrace1( TRACE_NORMAL, CMTPSVCCOMPOUNDPROCESSOR_SENDOBJECTPROPLISTL, "Exit with responseCode = 0x%04X", responseCode ); |
|
936 OstTraceFunctionExit0( CMTPSVCCOMPOUNDPROCESSOR_SENDOBJECTPROPLISTL_EXIT ); |
909 return responseCode; |
937 return responseCode; |
910 } |
938 } |
911 |
939 |
912 // All object handlers current don't support partial update, so once update one parameter failed, |
940 // All object handlers current don't support partial update, so once update one parameter failed, |
913 // all updated will be reverted. |
941 // all updated will be reverted. |
914 TMTPResponseCode CMTPSvcCompoundProcessor::UpdateObjectPropListL(CMTPObjectMetaData& aObjectMetaData, |
942 TMTPResponseCode CMTPSvcCompoundProcessor::UpdateObjectPropListL(CMTPObjectMetaData& aObjectMetaData, |
915 const CMTPTypeObjectPropList& aObjectPropList, |
943 const CMTPTypeObjectPropList& aObjectPropList, |
916 TUint32& /*aParameter*/) |
944 TUint32& /*aParameter*/) |
917 { |
945 { |
918 __FLOG(_L8("UpdateObjectPropList - Entry")); |
946 OstTraceFunctionEntry0( CMTPSVCCOMPOUNDPROCESSOR_UPDATEOBJECTPROPLISTL_ENTRY ); |
919 TMTPResponseCode responseCode = EMTPRespCodeOK; |
947 TMTPResponseCode responseCode = EMTPRespCodeOK; |
920 const TUint count = aObjectPropList.NumberOfElements(); |
948 const TUint count = aObjectPropList.NumberOfElements(); |
921 aObjectPropList.ResetCursor(); |
949 aObjectPropList.ResetCursor(); |
922 for (TUint i = 0; i < count; i++) |
950 for (TUint i = 0; i < count; i++) |
923 { |
951 { |