equal
deleted
inserted
replaced
24 #include "mmmtpdpconfig.h" |
24 #include "mmmtpdpconfig.h" |
25 #include "cmmmtpdpmetadataaccesswrapper.h" |
25 #include "cmmmtpdpmetadataaccesswrapper.h" |
26 #include "mmmtpdputility.h" |
26 #include "mmmtpdputility.h" |
27 |
27 |
28 const TInt KMaxDeletionTimes = 10; |
28 const TInt KMaxDeletionTimes = 10; |
|
29 const TInt KMaxDeviceBusyTimes = 3; |
29 const TInt KDeletionThreshold = 100 * 1000; // (100 millisec) |
30 const TInt KDeletionThreshold = 100 * 1000; // (100 millisec) |
30 |
31 |
31 // ----------------------------------------------------------------------------- |
32 // ----------------------------------------------------------------------------- |
32 // Verification data for the DeleteObject request |
33 // Verification data for the DeleteObject request |
33 // ----------------------------------------------------------------------------- |
34 // ----------------------------------------------------------------------------- |
292 { |
293 { |
293 TRAP_IGNORE( ProcessFinalPhaseL() ); |
294 TRAP_IGNORE( ProcessFinalPhaseL() ); |
294 } |
295 } |
295 |
296 |
296 // ----------------------------------------------------------------------------- |
297 // ----------------------------------------------------------------------------- |
|
298 // CDeleteObject::DoHandleCompletingPhaseL |
|
299 // Completeing phase Handler |
|
300 // ----------------------------------------------------------------------------- |
|
301 // |
|
302 EXPORT_C TBool CDeleteObject::DoHandleCompletingPhaseL() |
|
303 { |
|
304 CRequestProcessor::DoHandleCompletingPhaseL(); |
|
305 |
|
306 // If the response code is EMTPRespCodeDeviceBusy, don't release this object |
|
307 TBool result = !iDeviceBusy; |
|
308 |
|
309 PRINT2( _L( "MM MTP <> CDeleteObject::DoHandleCompletingPhaseL iDeleteError= %d, result = %d" ), |
|
310 iDeleteError, |
|
311 result ); |
|
312 |
|
313 return result; |
|
314 } |
|
315 |
|
316 // ----------------------------------------------------------------------------- |
297 // CDeleteObject::ProcessFinalPhaseL |
317 // CDeleteObject::ProcessFinalPhaseL |
298 // Delete all of the associations if file deletion was successful |
318 // Delete all of the associations if file deletion was successful |
299 // Then signals that the deletion has been completed |
319 // Then signals that the deletion has been completed |
300 // ----------------------------------------------------------------------------- |
320 // ----------------------------------------------------------------------------- |
301 // |
321 // |
303 { |
323 { |
304 PRINT( _L( "MM MTP => CDeleteObject::ProcessFinalPhaseL" ) ); |
324 PRINT( _L( "MM MTP => CDeleteObject::ProcessFinalPhaseL" ) ); |
305 |
325 |
306 TInt num = iObjectsToDelete.Count(); |
326 TInt num = iObjectsToDelete.Count(); |
307 TBool isOk = iDeleteError == KErrNone || iDeleteError == KErrNotFound; |
327 TBool isOk = iDeleteError == KErrNone || iDeleteError == KErrNotFound; |
|
328 iDeviceBusy = EFalse; |
308 |
329 |
309 if ( num == 0 && isOk ) |
330 if ( num == 0 && isOk ) |
310 { |
331 { |
311 SendResponseL( EMTPRespCodeOK ); |
332 SendResponseL( EMTPRespCodeOK ); |
312 } |
333 } |
313 else if ( iIsMultiDelete && !isOk ) |
334 else if ( iIsMultiDelete && !isOk ) |
314 { |
335 { |
315 SendResponseL( EMTPRespCodePartialDeletion ); |
336 SendResponseL( EMTPRespCodePartialDeletion ); |
316 } |
337 } |
317 else if ( !iIsMultiDelete && iDeleteError == KErrAccessDenied ) |
338 else if ( !iIsMultiDelete && iDeleteError == KErrAccessDenied ) |
318 { |
339 { |
319 SendResponseL( EMTPRespCodeObjectWriteProtected ); |
340 SendResponseL( EMTPRespCodeObjectWriteProtected ); |
320 } |
341 } |
321 else if ( iDeleteError == KErrInUse ) |
342 else if ( iDeleteError == KErrInUse |
322 { |
343 && iCountDeviceBusyError < KMaxDeviceBusyTimes ) |
|
344 { |
|
345 iCountDeviceBusyError++; |
323 SendResponseL( EMTPRespCodeDeviceBusy ); |
346 SendResponseL( EMTPRespCodeDeviceBusy ); |
|
347 iDeviceBusy = ETrue; |
324 } |
348 } |
325 else |
349 else |
326 { |
350 { |
327 SendResponseL( EMTPRespCodeAccessDenied ); |
351 SendResponseL( EMTPRespCodeAccessDenied ); |
328 } |
352 } |