mtpdataproviders/mtpimagedp/src/cmtpimagedpmoveobject.cpp
changeset 47 63cf70d3ecd8
parent 33 883e91c086aa
--- a/mtpdataproviders/mtpimagedp/src/cmtpimagedpmoveobject.cpp	Thu Sep 02 21:21:26 2010 +0300
+++ b/mtpdataproviders/mtpimagedp/src/cmtpimagedpmoveobject.cpp	Fri Sep 17 08:34:51 2010 +0300
@@ -36,8 +36,11 @@
 #include "mtpimagedputilits.h"
 #include "cmtpimagedpthumbnailcreator.h"
 #include "cmtpimagedp.h"
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "cmtpimagedpmoveobjectTraces.h"
+#endif
 
-__FLOG_STMT(_LIT8(KComponent,"MoveObject");)
 
 /**
 Verification data for the MoveObject request
@@ -69,12 +72,11 @@
 */	
 CMTPImageDpMoveObject::~CMTPImageDpMoveObject()
     {
-    __FLOG(_L8(">> CMTPImageDpMoveObject::~CMTPImageDpMoveObject")); 
+    OstTraceFunctionEntry0( CMTPIMAGEDPMOVEOBJECT_CMTPIMAGEDPMOVEOBJECT_ENTRY );
     delete iDest;
     delete iFileMan;
     delete iObjectInfo;
-    __FLOG(_L8("<< CMTPImageDpMoveObject::~CMTPImageDpMoveObject"));
-    __FLOG_CLOSE;
+    OstTraceFunctionExit0( CMTPIMAGEDPMOVEOBJECT_CMTPIMAGEDPMOVEOBJECT_EXIT );
     }
 
 /**
@@ -84,7 +86,6 @@
     CMTPRequestProcessor(aFramework, aConnection, sizeof(KMTPMoveObjectPolicy)/sizeof(TMTPRequestElementInfo), KMTPMoveObjectPolicy),
     iDataProvider(aDataProvider)
     {
-    __FLOG_OPEN(KMTPSubsystem, KComponent);
     }
 	
 /**
@@ -92,15 +93,15 @@
 */
 void CMTPImageDpMoveObject::ConstructL()
     {
-    __FLOG(_L8(">> CMTPImageDpMoveObject::ConstructL")); 
+    OstTraceFunctionEntry0( CMTPIMAGEDPMOVEOBJECT_CONSTRUCTL_ENTRY );
     iFileMan = CFileMan::NewL(iFramework.Fs());
     iObjectInfo = CMTPObjectMetaData::NewL();
-    __FLOG(_L8("<< CMTPImageDpMoveObject::ConstructL")); 
+    OstTraceFunctionExit0( CMTPIMAGEDPMOVEOBJECT_CONSTRUCTL_EXIT );
     }
 
 TMTPResponseCode CMTPImageDpMoveObject::CheckRequestL()
     {
-    __FLOG(_L8(">> CMTPImageDpCopyObject::CheckRequestL"));
+    OstTraceFunctionEntry0( CMTPIMAGEDPMOVEOBJECT_CHECKREQUESTL_ENTRY );
     TMTPResponseCode responseCode = CMTPRequestProcessor::CheckRequestL();
     if (EMTPRespCodeOK == responseCode)
         {
@@ -113,8 +114,9 @@
         responseCode = EMTPRespCodeInvalidParentObject;
         }
     
-    __FLOG_VA((_L8("CheckRequestL - Exit with responseCode = 0x%04X"), responseCode));
-    __FLOG(_L8("<< CMTPImageDpCopyObject::CheckRequestL"));
+    OstTrace1( TRACE_NORMAL, CMTPIMAGEDPMOVEOBJECT_CHECKREQUESTL, 
+            "CheckRequestL - Exit with responseCode = 0x%04X", responseCode );
+    OstTraceFunctionExit0( CMTPIMAGEDPMOVEOBJECT_CHECKREQUESTL_EXIT );
     return responseCode;
     }
 
@@ -123,12 +125,12 @@
 */		
 void CMTPImageDpMoveObject::ServiceL()
     {
-    __FLOG(_L8(">> CMTPImageDpMoveObject::ServiceL"));
+    OstTraceFunctionEntry0( CMTPIMAGEDPMOVEOBJECT_SERVICEL_ENTRY );
     
     TMTPResponseCode ret = MoveObjectL();
     SendResponseL(ret);
-    
-    __FLOG(_L8("<< CMTPImageDpMoveObject::ServiceL")); 
+
+    OstTraceFunctionExit0( CMTPIMAGEDPMOVEOBJECT_SERVICEL_EXIT );
     }
 
 /**
@@ -137,7 +139,7 @@
 */
 TMTPResponseCode CMTPImageDpMoveObject::MoveFileL(const TDesC& aOldFileName, const TDesC& aNewFileName)	
     {
-    __FLOG(_L8(">> CMTPImageDpMoveObject::MoveFileL"));
+    OstTraceFunctionEntry0( CMTPIMAGEDPMOVEOBJECT_MOVEFILEL_ENTRY );
     
     TMTPResponseCode responseCode = EMTPRespCodeOK;    
     /**
@@ -173,22 +175,23 @@
     iObjectInfo->SetUint(CMTPObjectMetaData::EStorageId, iStorageId);
     iObjectInfo->SetUint(CMTPObjectMetaData::EParentHandle, iNewParentHandle);
     iFramework.ObjectMgr().ModifyObjectL(*iObjectInfo);
-    __FLOG_VA((_L16("CMTPImageDpMoveObject::MoveFileL - Update object info:%S"), &aNewFileName));
+    OstTraceExt1( TRACE_NORMAL, DUP2_CMTPIMAGEDPMOVEOBJECT_MOVEFILEL, 
+            "CMTPImageDpMoveObject::MoveFileL - Update object info:%S", aNewFileName );
     
     TInt ret = MoveImageFile(aOldFileName, *iDest);
     if (ret != KErrNone)
         {
         //rollback
-        __FLOG_VA((_L16("CMTPImageDpMoveObject::MoveFileL - Rollback")));
+        OstTrace0( TRACE_NORMAL, DUP1_CMTPIMAGEDPMOVEOBJECT_MOVEFILEL, "CMTPImageDpMoveObject::MoveFileL - Rollback" );
         iObjectInfo->SetDesCL(CMTPObjectMetaData::ESuid, aOldFileName);
         iObjectInfo->SetUint(CMTPObjectMetaData::EStorageId, oldStoradId);
         iObjectInfo->SetUint(CMTPObjectMetaData::EParentHandle, oldParentHandle);
         iFramework.ObjectMgr().ModifyObjectL(*iObjectInfo);       
         responseCode = EMTPRespCodeGeneralError;        
         }
-    __FLOG_VA((_L8("CMTPImageDpMoveObject::MoveFileL - MoveImageFile:%d"), ret));
-    
-    __FLOG(_L8("<< CMTPImageDpMoveObject::MoveFileL")); 	
+    OstTrace1( TRACE_NORMAL, CMTPIMAGEDPMOVEOBJECT_MOVEFILEL, "- MoveImageFile:%d", ret );
+
+    OstTraceFunctionExit0( CMTPIMAGEDPMOVEOBJECT_MOVEFILEL_EXIT );
     return responseCode;
     }
 /**
@@ -197,7 +200,7 @@
 */
 TMTPResponseCode CMTPImageDpMoveObject::MoveObjectL()
     {
-    __FLOG(_L8(">> CMTPImageDpMoveObject::MoveObjectL"));
+    OstTraceFunctionEntry0( CMTPIMAGEDPMOVEOBJECT_MOVEOBJECTL_ENTRY );
     TMTPResponseCode responseCode = EMTPRespCodeOK;
     GetParametersL();
     RBuf newObjectName;
@@ -221,7 +224,7 @@
         responseCode = MoveFileL(oldFileName, newObjectName);
         }
     CleanupStack::PopAndDestroy(); // newObjectName.
-    __FLOG(_L8("<< CMTPImageDpMoveObject::MoveObjectL")); 	
+    OstTraceFunctionExit0( CMTPIMAGEDPMOVEOBJECT_MOVEOBJECTL_EXIT );
     return responseCode;
     }
 
@@ -230,7 +233,7 @@
 */	
 void CMTPImageDpMoveObject::GetParametersL()
     {
-    __FLOG(_L8(">> CMTPImageDpMoveObject::GetParametersL"));
+    OstTraceFunctionEntry0( CMTPIMAGEDPMOVEOBJECT_GETPARAMETERSL_ENTRY );
     __ASSERT_DEBUG(iRequestChecker, Panic(EMTPImageDpRequestCheckNull));
     
     TUint32 objectHandle  = Request().Uint32(TMTPTypeRequest::ERequestParameter1);
@@ -249,7 +252,7 @@
         iDest = NULL;
         iDest = parentObjectInfo->DesC(CMTPObjectMetaData::ESuid).AllocL();
         }
-    __FLOG(_L8("<< CMTPImageDpMoveObject::GetParametersL"));
+    OstTraceFunctionExit0( CMTPIMAGEDPMOVEOBJECT_GETPARAMETERSL_EXIT );
     }
     
 /**
@@ -257,13 +260,13 @@
 */
 void CMTPImageDpMoveObject::SetDefaultParentObjectL()
     {
-    __FLOG(_L8(">> CMTPImageDpMoveObject::SetDefaultParentObjectL"));  
+    OstTraceFunctionEntry0( CMTPIMAGEDPMOVEOBJECT_SETDEFAULTPARENTOBJECTL_ENTRY );
     const CMTPStorageMetaData& storage = iFramework.StorageMgr().StorageL(iStorageId);
     delete iDest;
     iDest = NULL;
     iDest = storage.DesC(CMTPStorageMetaData::EStorageSuid).AllocL();
     iNewParentHandle = KMTPHandleNoParent;
-    __FLOG(_L8("<< CMTPImageDpMoveObject::SetDefaultParentObjectL"));  
+    OstTraceFunctionExit0( CMTPIMAGEDPMOVEOBJECT_SETDEFAULTPARENTOBJECTL_EXIT );
     }
 
 /**
@@ -271,15 +274,21 @@
 */
 TMTPResponseCode CMTPImageDpMoveObject::CanMoveObjectL(const TDesC& aOldName, const TDesC& aNewName) const
     {
-    __FLOG(_L8(">> CMTPImageDpMoveObject::CanMoveObjectL"));     
+    OstTraceFunctionEntry0( CMTPIMAGEDPMOVEOBJECT_CANMOVEOBJECTL_ENTRY );   
     TMTPResponseCode result = EMTPRespCodeOK;
 
     TEntry fileEntry;
-    User::LeaveIfError(iFramework.Fs().Entry(aOldName, fileEntry));
+    LEAVEIFERROR(iFramework.Fs().Entry(aOldName, fileEntry),
+            OstTraceExt2( TRACE_ERROR, CMTPIMAGEDPMOVEOBJECT_CANMOVEOBJECTL, 
+                    "Gets the entry details for %S failed! error code %d", aOldName, munged_err ));
     TDriveNumber drive(static_cast<TDriveNumber>(iFramework.StorageMgr().DriveNumber(iStorageId)));
-    User::LeaveIfError(drive);
+    LEAVEIFERROR(drive,
+            OstTraceExt2( TRACE_ERROR, DUP1_CMTPIMAGEDPMOVEOBJECT_CANMOVEOBJECTL, 
+                    "Gets drive for storage %d failed! error code %d", iStorageId, munged_err ));
     TVolumeInfo volumeInfo;
-    User::LeaveIfError(iFramework.Fs().Volume(volumeInfo, drive));
+    LEAVEIFERROR(iFramework.Fs().Volume(volumeInfo, drive),
+            OstTraceExt2( TRACE_ERROR, DUP2_CMTPIMAGEDPMOVEOBJECT_CANMOVEOBJECTL, 
+                    "Gets volume information for driver %d failed! error code %d", drive, munged_err ));
     
     if(volumeInfo.iFree < fileEntry.FileSize())
         {
@@ -289,16 +298,16 @@
         {
         result = EMTPRespCodeInvalidParentObject;
         }
-    __FLOG_VA((_L8("CanMoveObjectL - Exit with response code 0x%04X"), result));
-    __FLOG(_L8("<< CMTPImageDpMoveObject::CanMoveObjectL"));     
+    OstTrace1( TRACE_NORMAL, DUP3_CMTPIMAGEDPMOVEOBJECT_CANMOVEOBJECTL, "Exit with response code 0x%04X", result );
+    OstTraceFunctionExit0( CMTPIMAGEDPMOVEOBJECT_CANMOVEOBJECTL_EXIT );
     return result;	
     }
 
 TInt CMTPImageDpMoveObject::MoveImageFile(const TDesC& aOldImageName, const TDesC& aNewImageName)
     {
-    __FLOG(_L8(">> CMTPImageDpMoveObject::MoveImageFile"));
-    __FLOG_VA((_L8("move image src: %S dest: %S"), &aOldImageName, &aNewImageName));        
-    __FLOG(_L8("<< CMTPImageDpMoveObject::MoveImageFile"));
+    OstTraceFunctionEntry0( CMTPIMAGEDPMOVEOBJECT_MOVEIMAGEFILE_ENTRY ); 
+    OstTraceExt2( TRACE_NORMAL, CMTPIMAGEDPMOVEOBJECT_MOVEIMAGEFILE, "move image src: %S dest: %S", aOldImageName, aNewImageName );
+    OstTraceFunctionExit0( CMTPIMAGEDPMOVEOBJECT_MOVEIMAGEFILE_EXIT ); 
     return iFileMan->Move(aOldImageName, aNewImageName);
     }