mtpdataproviders/mtpimagedp/src/cmtpimagedpgetobjectinfo.cpp
changeset 49 c20dd21d1eb4
parent 31 a26669f87b46
equal deleted inserted replaced
41:2c19c7cf5550 49:c20dd21d1eb4
    30 #include "cmtpimagedpobjectpropertymgr.h"
    30 #include "cmtpimagedpobjectpropertymgr.h"
    31 #include "mtpimagedpconst.h"
    31 #include "mtpimagedpconst.h"
    32 #include "mtpimagedppanic.h"
    32 #include "mtpimagedppanic.h"
    33 #include "cmtpimagedp.h"
    33 #include "cmtpimagedp.h"
    34 #include "mtpimagedputilits.h"
    34 #include "mtpimagedputilits.h"
    35 
    35 #include "OstTraceDefinitions.h"
    36 __FLOG_STMT(_LIT8(KComponent,"CMTPImageDpGetObjectInfo");)
    36 #ifdef OST_TRACE_COMPILER_IN_USE
       
    37 #include "cmtpimagedpgetobjectinfoTraces.h"
       
    38 #endif
       
    39 
    37 
    40 
    38 /**
    41 /**
    39 Two-phase construction method
    42 Two-phase construction method
    40 @param aFramework	The data provider framework
    43 @param aFramework	The data provider framework
    41 @param aConnection	The connection from which the request comes
    44 @param aConnection	The connection from which the request comes
    54 /**
    57 /**
    55 Destructor
    58 Destructor
    56 */	
    59 */	
    57 CMTPImageDpGetObjectInfo::~CMTPImageDpGetObjectInfo()
    60 CMTPImageDpGetObjectInfo::~CMTPImageDpGetObjectInfo()
    58     {
    61     {
    59     __FLOG(_L8(">> ~CMTPImageDpGetObjectInfo"));
    62     OstTraceFunctionEntry0( CMTPIMAGEDPGETOBJECTINFO_CMTPIMAGEDPGETOBJECTINFO_DES_ENTRY );
    60     delete iObjectInfoToBuild;
    63     delete iObjectInfoToBuild;
    61     delete iObjectMeta;
    64     delete iObjectMeta;
    62     __FLOG(_L8("<< ~CMTPImageDpGetObjectInfo"));
    65     OstTraceFunctionExit0( CMTPIMAGEDPGETOBJECTINFO_CMTPIMAGEDPGETOBJECTINFO_DES_EXIT );
    63     __FLOG_CLOSE;
       
    64     }
    66     }
    65 
    67 
    66 /**
    68 /**
    67 Standard c++ constructor
    69 Standard c++ constructor
    68 */	
    70 */	
    69 CMTPImageDpGetObjectInfo::CMTPImageDpGetObjectInfo(MMTPDataProviderFramework& aFramework,
    71 CMTPImageDpGetObjectInfo::CMTPImageDpGetObjectInfo(MMTPDataProviderFramework& aFramework,
    70                                     MMTPConnection& aConnection,CMTPImageDataProvider& aDataProvider) : 
    72                                     MMTPConnection& aConnection,CMTPImageDataProvider& aDataProvider) : 
    71     CMTPRequestProcessor(aFramework, aConnection, 0, NULL),
    73     CMTPRequestProcessor(aFramework, aConnection, 0, NULL),
    72     iObjectPropertyMgr(aDataProvider.PropertyMgr())
    74     iObjectPropertyMgr(aDataProvider.PropertyMgr())
    73     {
    75     {
    74     __FLOG_OPEN(KMTPSubsystem, KComponent);
       
    75     __FLOG(_L8("CMTPImageDpGetObjectInfo::CMTPImageDpGetObjectInfo"));
       
    76     }
    76     }
    77 
    77 
    78 TMTPResponseCode CMTPImageDpGetObjectInfo::CheckRequestL()
    78 TMTPResponseCode CMTPImageDpGetObjectInfo::CheckRequestL()
    79     {
    79     {
    80     __FLOG(_L8(">> CMTPImageDpGetObject::CheckRequestL"));
    80     OstTraceFunctionEntry0( CMTPIMAGEDPGETOBJECTINFO_CHECKREQUESTL_ENTRY );
    81     TMTPResponseCode result = MTPImageDpUtilits::VerifyObjectHandleL(iFramework, Request().Uint32(TMTPTypeRequest::ERequestParameter1), *iObjectMeta);
    81     TMTPResponseCode result = MTPImageDpUtilits::VerifyObjectHandleL(iFramework, Request().Uint32(TMTPTypeRequest::ERequestParameter1), *iObjectMeta);
    82     __FLOG(_L8("<< CMTPImageDpGetObject::CheckRequestL"));
    82     OstTraceFunctionExit0( CMTPIMAGEDPGETOBJECTINFO_CHECKREQUESTL_EXIT );
    83     return result;
    83     return result;
    84     }
    84     }
    85     
    85     
    86 /**
    86 /**
    87 GetObjectInfo request handler
    87 GetObjectInfo request handler
    88 */		
    88 */		
    89 void CMTPImageDpGetObjectInfo::ServiceL()
    89 void CMTPImageDpGetObjectInfo::ServiceL()
    90     {
    90     {
    91     __FLOG(_L8(">> CMTPImageDpGetObjectInfo::ServiceL"));
    91     OstTraceFunctionEntry0( CMTPIMAGEDPGETOBJECTINFO_SERVICEL_ENTRY );
    92     BuildObjectInfoL();
    92     BuildObjectInfoL();
    93     SendDataL(*iObjectInfoToBuild);	
    93     SendDataL(*iObjectInfoToBuild);	
    94     __FLOG(_L8("<< CMTPImageDpGetObjectInfo::ServiceL"));
    94     OstTraceFunctionExit0( CMTPIMAGEDPGETOBJECTINFO_SERVICEL_EXIT );
    95     }
    95     }
    96     
    96     
    97 /**
    97 /**
    98 Second-phase construction
    98 Second-phase construction
    99 */		
    99 */		
   100 void CMTPImageDpGetObjectInfo::ConstructL()
   100 void CMTPImageDpGetObjectInfo::ConstructL()
   101     {
   101     {
   102     __FLOG(_L8(">> CMTPImageDpGetObjectInfo::ConstructL"));
   102     OstTraceFunctionEntry0( CMTPIMAGEDPGETOBJECTINFO_CONSTRUCTL_ENTRY );
   103     iObjectInfoToBuild = CMTPTypeObjectInfo::NewL();
   103     iObjectInfoToBuild = CMTPTypeObjectInfo::NewL();
   104     iObjectMeta = CMTPObjectMetaData::NewL();
   104     iObjectMeta = CMTPObjectMetaData::NewL();
   105     __FLOG(_L8("<< CMTPImageDpGetObjectInfo::ConstructL"));
   105     OstTraceFunctionExit0( CMTPIMAGEDPGETOBJECTINFO_CONSTRUCTL_EXIT );
   106     }
   106     }
   107     
   107     
   108 /**
   108 /**
   109 Populate the object info dataset
   109 Populate the object info dataset
   110 */		
   110 */		
   111 void CMTPImageDpGetObjectInfo::BuildObjectInfoL()	
   111 void CMTPImageDpGetObjectInfo::BuildObjectInfoL()	
   112     {
   112     {
   113     __FLOG(_L8(">> CMTPImageDpGetObjectInfo::BuildObjectInfoL"));
   113     OstTraceFunctionEntry0( CMTPIMAGEDPGETOBJECTINFO_BUILDOBJECTINFOL_ENTRY );
   114     iObjectPropertyMgr.SetCurrentObjectL(*iObjectMeta, EFalse);
   114     iObjectPropertyMgr.SetCurrentObjectL(*iObjectMeta, EFalse);
   115     
   115     
   116     //1. storage id
   116     //1. storage id
   117     TUint32 storageId(0);
   117     TUint32 storageId(0);
   118     iObjectPropertyMgr.GetPropertyL(EMTPObjectPropCodeStorageID, storageId);
   118     iObjectPropertyMgr.GetPropertyL(EMTPObjectPropCodeStorageID, storageId);
   180     //4, compressed size, 17 Date created, and 18 Date modified
   180     //4, compressed size, 17 Date created, and 18 Date modified
   181     SetFileSizeDateL();
   181     SetFileSizeDateL();
   182     
   182     
   183     //18. keyword
   183     //18. keyword
   184     SetKeywordL();
   184     SetKeywordL();
   185     __FLOG(_L8("<< CMTPImageDpGetObjectInfo::BuildObjectInfoL"));
   185     OstTraceFunctionExit0( CMTPIMAGEDPGETOBJECTINFO_BUILDOBJECTINFOL_EXIT );
   186     }
   186     }
   187 /**
   187 /**
   188 Set the file name of the current object in the data set
   188 Set the file name of the current object in the data set
   189 @param aObjectInfo The object info of the current object
   189 @param aObjectInfo The object info of the current object
   190 */	
   190 */	
   191 void CMTPImageDpGetObjectInfo::SetFileNameL()
   191 void CMTPImageDpGetObjectInfo::SetFileNameL()
   192     {
   192     {
       
   193     OstTraceFunctionEntry0( CMTPIMAGEDPGETOBJECTINFO_SETFILENAMEL_ENTRY );
   193     //use the name without full path specification
   194     //use the name without full path specification
   194     __FLOG(_L8(">> CMTPImageDpGetObjectInfo::SetFileNameL"));
       
   195     CMTPTypeString* fileName = CMTPTypeString::NewLC();
   195     CMTPTypeString* fileName = CMTPTypeString::NewLC();
   196     iObjectPropertyMgr.GetPropertyL(EMTPObjectPropCodeObjectFileName, *fileName);
   196     iObjectPropertyMgr.GetPropertyL(EMTPObjectPropCodeObjectFileName, *fileName);
   197     iObjectInfoToBuild->SetStringL(CMTPTypeObjectInfo::EFilename, fileName->StringChars());
   197     iObjectInfoToBuild->SetStringL(CMTPTypeObjectInfo::EFilename, fileName->StringChars());
   198     CleanupStack::PopAndDestroy(fileName);
   198     CleanupStack::PopAndDestroy(fileName);
   199     __FLOG(_L8("<< CMTPImageDpGetObjectInfo::SetFileNameL"));
   199     OstTraceFunctionExit0( CMTPIMAGEDPGETOBJECTINFO_SETFILENAMEL_EXIT );
   200     }
   200     }
   201     
   201     
   202 /**
   202 /**
   203 Set the file size and modified/created date in the data set
   203 Set the file size and modified/created date in the data set
   204 @param aObjectInfo The object info of the current object
   204 @param aObjectInfo The object info of the current object
   205 */	
   205 */	
   206 void CMTPImageDpGetObjectInfo::SetFileSizeDateL()
   206 void CMTPImageDpGetObjectInfo::SetFileSizeDateL()
   207     {
   207     {
       
   208     OstTraceFunctionEntry0( CMTPIMAGEDPGETOBJECTINFO_SETFILESIZEDATEL_ENTRY );
   208     //file size
   209     //file size
   209     __FLOG(_L8(">> CMTPImageDpGetObjectInfo::SetFileSizeDateL"));
       
   210     TUint64 fileSize;
   210     TUint64 fileSize;
   211     iObjectPropertyMgr.GetPropertyL(EMTPObjectPropCodeObjectSize, fileSize);
   211     iObjectPropertyMgr.GetPropertyL(EMTPObjectPropCodeObjectSize, fileSize);
   212     TUint32 shortFileSize = (fileSize > KMaxTUint32) ? KMaxTUint32 : static_cast<TUint32>(fileSize);
   212     TUint32 shortFileSize = (fileSize > KMaxTUint32) ? KMaxTUint32 : static_cast<TUint32>(fileSize);
   213     iObjectInfoToBuild->SetUint32L(CMTPTypeObjectInfo::EObjectCompressedSize, shortFileSize);
   213     iObjectInfoToBuild->SetUint32L(CMTPTypeObjectInfo::EObjectCompressedSize, shortFileSize);
   214     
   214     
   220     CMTPTypeString* createdString = CMTPTypeString::NewLC();
   220     CMTPTypeString* createdString = CMTPTypeString::NewLC();
   221     iObjectPropertyMgr.GetPropertyL(EMTPObjectPropCodeDateCreated, *createdString);
   221     iObjectPropertyMgr.GetPropertyL(EMTPObjectPropCodeDateCreated, *createdString);
   222     iObjectInfoToBuild->SetStringL(CMTPTypeObjectInfo::EDateCreated, createdString->StringChars());	
   222     iObjectInfoToBuild->SetStringL(CMTPTypeObjectInfo::EDateCreated, createdString->StringChars());	
   223     
   223     
   224     CleanupStack::PopAndDestroy(2); // createdString, dateString
   224     CleanupStack::PopAndDestroy(2); // createdString, dateString
   225     __FLOG(_L8("<< CMTPImageDpGetObjectInfo::SetFileSizeDateL"));
   225     OstTraceFunctionExit0( CMTPIMAGEDPGETOBJECTINFO_SETFILESIZEDATEL_EXIT );
   226     }
   226     }
   227     
   227     
   228 /**
   228 /**
   229 Set the keyword of the current object in the data set
   229 Set the keyword of the current object in the data set
   230 @param aObjectInfo The object info of the current object
   230 @param aObjectInfo The object info of the current object
   231 */	
   231 */	
   232 void CMTPImageDpGetObjectInfo::SetKeywordL()
   232 void CMTPImageDpGetObjectInfo::SetKeywordL()
   233     {
   233     {
       
   234     OstTraceFunctionEntry0( CMTPIMAGEDPGETOBJECTINFO_SETKEYWORDL_ENTRY );
   234     //empty keyword
   235     //empty keyword
   235     __FLOG(_L8(">> CMTPImageDpGetObjectInfo::SetKeywordL"));
       
   236     iObjectInfoToBuild->SetStringL(CMTPTypeObjectInfo::EKeywords, KNullDesC);
   236     iObjectInfoToBuild->SetStringL(CMTPTypeObjectInfo::EKeywords, KNullDesC);
   237     __FLOG(_L8("<< CMTPImageDpGetObjectInfo::SetKeywordL"));
   237     OstTraceFunctionExit0( CMTPIMAGEDPGETOBJECTINFO_SETKEYWORDL_EXIT );
   238     }
   238     }