mtpdataproviders/mtpimagedp/src/cmtpimagedpgetobject.cpp
changeset 49 c20dd21d1eb4
parent 31 a26669f87b46
equal deleted inserted replaced
41:2c19c7cf5550 49:c20dd21d1eb4
    32 #include "cmtpimagedpgetobject.h"
    32 #include "cmtpimagedpgetobject.h"
    33 #include "mtpimagedppanic.h"
    33 #include "mtpimagedppanic.h"
    34 #include "cmtpimagedp.h"
    34 #include "cmtpimagedp.h"
    35 #include "mtpimagedpconst.h"
    35 #include "mtpimagedpconst.h"
    36 #include "mtpimagedputilits.h"
    36 #include "mtpimagedputilits.h"
       
    37 #include "OstTraceDefinitions.h"
       
    38 #ifdef OST_TRACE_COMPILER_IN_USE
       
    39 #include "cmtpimagedpgetobjectTraces.h"
       
    40 #endif
    37 
    41 
    38 // Class constants.
       
    39 __FLOG_STMT(_LIT8(KComponent,"ImageDpGetObject");)
       
    40 
    42 
    41 /**
    43 /**
    42 Verification data for the GetNumObjects request
    44 Verification data for the GetNumObjects request
    43 */
    45 */
    44 const TMTPRequestElementInfo KMTPGetObjectPolicy[] = 
    46 const TMTPRequestElementInfo KMTPGetObjectPolicy[] = 
    65 /**
    67 /**
    66 Destructor
    68 Destructor
    67 */	
    69 */	
    68 CMTPImageDpGetObject::~CMTPImageDpGetObject()
    70 CMTPImageDpGetObject::~CMTPImageDpGetObject()
    69     {
    71     {
    70     __FLOG(_L8(">> ~CMTPImageDpGetObject"));
    72     OstTraceFunctionEntry0( CMTPIMAGEDPGETOBJECT_CMTPIMAGEDPGETOBJECT_ENTRY );
    71     delete iFileObject;
    73     delete iFileObject;
    72     __FLOG(_L8("<< ~CMTPImageDpGetObject"));
    74     OstTraceFunctionExit0( CMTPIMAGEDPGETOBJECT_CMTPIMAGEDPGETOBJECT_EXIT );
    73     __FLOG_CLOSE;
       
    74     }
    75     }
    75 	
    76 	
    76 /**
    77 /**
    77 Standard c++ constructor
    78 Standard c++ constructor
    78 */	
    79 */	
    87 /**
    88 /**
    88 Second-phase constructor.
    89 Second-phase constructor.
    89 */        
    90 */        
    90 void CMTPImageDpGetObject::ConstructL()
    91 void CMTPImageDpGetObject::ConstructL()
    91     {
    92     {
    92     __FLOG_OPEN(KMTPSubsystem, KComponent);
    93     OstTraceFunctionEntry0( CMTPIMAGEDPGETOBJECT_CONSTRUCTL_ENTRY );
    93     __FLOG(_L8(">> CMTPImageDpGetObject::ConstructL"));   
    94     OstTraceFunctionExit0( CMTPIMAGEDPGETOBJECT_CONSTRUCTL_EXIT );
    94     __FLOG(_L8("<< CMTPImageDpGetObject::ConstructL"));
       
    95     }
    95     }
    96 TMTPResponseCode CMTPImageDpGetObject::CheckRequestL()
    96 TMTPResponseCode CMTPImageDpGetObject::CheckRequestL()
    97     {    
    97     {    
    98     __FLOG(_L8(">> CMTPImageDpGetObject::CheckRequestL"));
    98     OstTraceFunctionEntry0( CMTPIMAGEDPGETOBJECT_CHECKREQUESTL_ENTRY );
    99     TMTPResponseCode responseCode = CMTPRequestProcessor::CheckRequestL();
    99     TMTPResponseCode responseCode = CMTPRequestProcessor::CheckRequestL();
   100     
   100     
   101     TUint32 handle(Request().Uint32(TMTPTypeRequest::ERequestParameter1));
   101     TUint32 handle(Request().Uint32(TMTPTypeRequest::ERequestParameter1));
   102     if ( handle != KMTPHandleAll )
   102     if ( handle != KMTPHandleAll )
   103         {
   103         {
   104         CMTPObjectMetaData* ObjectMeta = CMTPObjectMetaData::NewL();
   104         CMTPObjectMetaData* ObjectMeta = CMTPObjectMetaData::NewL();
   105         responseCode = MTPImageDpUtilits::VerifyObjectHandleL(
   105         responseCode = MTPImageDpUtilits::VerifyObjectHandleL(
   106                 iFramework, handle, *ObjectMeta);
   106                 iFramework, handle, *ObjectMeta);
   107         delete ObjectMeta;
   107         delete ObjectMeta;
   108         }
   108         }
   109     __FLOG(_L8("<< CMTPImageDpGetObject::CheckRequestL"));
   109     OstTraceFunctionExit0( CMTPIMAGEDPGETOBJECT_CHECKREQUESTL_EXIT );
   110     return responseCode;
   110     return responseCode;
   111     }
   111     }
   112 /**
   112 /**
   113 GetObject request handler
   113 GetObject request handler
   114 */		
   114 */		
   115 void CMTPImageDpGetObject::ServiceL()
   115 void CMTPImageDpGetObject::ServiceL()
   116     {
   116     {
   117     __FLOG(_L8(">> CMTPImageDpGetObject::ServiceL"));
   117     OstTraceFunctionEntry0( CMTPIMAGEDPGETOBJECT_SERVICEL_ENTRY );
   118     
   118     
   119     TUint32 objectHandle = Request().Uint32(TMTPTypeRequest::ERequestParameter1);
   119     TUint32 objectHandle = Request().Uint32(TMTPTypeRequest::ERequestParameter1);
   120     //does not take ownership    
   120     //does not take ownership    
   121     CMTPObjectMetaData* objectInfo = iRequestChecker->GetObjectInfo(objectHandle);
   121     CMTPObjectMetaData* objectInfo = iRequestChecker->GetObjectInfo(objectHandle);
   122     __ASSERT_DEBUG(objectInfo, Panic(EMTPImageDpObjectNull));
   122     __ASSERT_DEBUG(objectInfo, Panic(EMTPImageDpObjectNull));
   123     
   123     
   124     BuildFileObjectL(objectInfo->DesC(CMTPObjectMetaData::ESuid));
   124     BuildFileObjectL(objectInfo->DesC(CMTPObjectMetaData::ESuid));
   125     SendDataL(*iFileObject);    
   125     SendDataL(*iFileObject);    
   126     __FLOG(_L8("<< CMTPImageDpGetObject::ServiceL"));
   126     OstTraceFunctionExit0( CMTPIMAGEDPGETOBJECT_SERVICEL_EXIT );
   127     }
   127     }
   128 		
   128 		
   129 
   129 
   130 /**
   130 /**
   131 Build the file object data set for the file requested
   131 Build the file object data set for the file requested
   132 @param aFileName	The file name of the requested object
   132 @param aFileName	The file name of the requested object
   133 */
   133 */
   134 void CMTPImageDpGetObject::BuildFileObjectL(const TDesC& aFileName)
   134 void CMTPImageDpGetObject::BuildFileObjectL(const TDesC& aFileName)
   135     {
   135     {
   136     __FLOG(_L8(">> CMTPImageDpGetObject::BuildFileObjectL"));
   136     OstTraceFunctionEntry0( CMTPIMAGEDPGETOBJECT_BUILDFILEOBJECTL_ENTRY );
   137     delete iFileObject;
   137     delete iFileObject;
   138     iFileObject = NULL;
   138     iFileObject = NULL;
   139     iFileObject = CMTPTypeFile::NewL(iFramework.Fs(), aFileName, EFileShareReadersOnly);
   139     iFileObject = CMTPTypeFile::NewL(iFramework.Fs(), aFileName, EFileShareReadersOnly);
   140     __FLOG(_L8("<< CMTPImageDpGetObject::BuildFileObjectL"));
   140     OstTraceFunctionExit0( CMTPIMAGEDPGETOBJECT_BUILDFILEOBJECTL_EXIT );
   141     }
   141     }
   142 
   142 
   143 TBool CMTPImageDpGetObject::DoHandleCompletingPhaseL()
   143 TBool CMTPImageDpGetObject::DoHandleCompletingPhaseL()
   144     {
   144     {
   145     __FLOG(_L8(" CMTPImageDpGetObject::DoHandleResponsePhaseL - Entry"));
   145     OstTraceFunctionEntry0( CMTPIMAGEDPGETOBJECT_DOHANDLECOMPLETINGPHASEL_ENTRY );
   146     
   146     
   147     /**
   147     /**
   148      * end-user does not cancel the operation, we think the getobject operation is successful.
   148      * end-user does not cancel the operation, we think the getobject operation is successful.
   149      */
   149      */
   150     if (!iCancelled)
   150     if (!iCancelled)
   156             //update new picture status            
   156             //update new picture status            
   157             MTPImageDpUtilits::UpdateObjectStatusToOldL(iFramework, *objectInfo);
   157             MTPImageDpUtilits::UpdateObjectStatusToOldL(iFramework, *objectInfo);
   158             iDataProvider.ResetNewPictures();
   158             iDataProvider.ResetNewPictures();
   159             }
   159             }
   160         }
   160         }
   161     
   161 
   162     __FLOG(_L8("CMTPImageDpGetObject::DoHandleResponsePhaseL - Exit"));
       
   163     return CMTPRequestProcessor::DoHandleCompletingPhaseL();
   162     return CMTPRequestProcessor::DoHandleCompletingPhaseL();
   164     }
   163     }