mtpfws/mtpfw/dataproviders/dputility/src/cmtpsvcgetserviceinfo.cpp
changeset 49 c20dd21d1eb4
parent 0 d0791faffa3f
equal deleted inserted replaced
41:2c19c7cf5550 49:c20dd21d1eb4
    16 #include <mtp/cmtptypeserviceinfo.h>
    16 #include <mtp/cmtptypeserviceinfo.h>
    17 
    17 
    18 #include "cmtpsvcgetserviceinfo.h"
    18 #include "cmtpsvcgetserviceinfo.h"
    19 #include "mmtpservicedataprovider.h"
    19 #include "mmtpservicedataprovider.h"
    20 #include "mmtpservicehandler.h"
    20 #include "mmtpservicehandler.h"
       
    21 #include "OstTraceDefinitions.h"
       
    22 #ifdef OST_TRACE_COMPILER_IN_USE
       
    23 #include "cmtpsvcgetserviceinfoTraces.h"
       
    24 #endif
    21 
    25 
    22 // Class constants.
    26 
    23 __FLOG_STMT(_LIT8(KComponent, "SvcGetSvcInfo");)
       
    24 
    27 
    25 EXPORT_C MMTPRequestProcessor* CMTPSvcGetServiceInfo::NewL(MMTPDataProviderFramework& aFramework, 
    28 EXPORT_C MMTPRequestProcessor* CMTPSvcGetServiceInfo::NewL(MMTPDataProviderFramework& aFramework, 
    26 												MMTPConnection& aConnection, 
    29 												MMTPConnection& aConnection, 
    27 												MMTPServiceDataProvider& aDataProvider)
    30 												MMTPServiceDataProvider& aDataProvider)
    28 	{
    31 	{
    33 	return self;
    36 	return self;
    34 	}
    37 	}
    35 
    38 
    36 EXPORT_C CMTPSvcGetServiceInfo::~CMTPSvcGetServiceInfo()
    39 EXPORT_C CMTPSvcGetServiceInfo::~CMTPSvcGetServiceInfo()
    37 	{
    40 	{
    38 	__FLOG(_L8("~CMTPSvcGetServiceInfo - Entry"));
    41 	OstTraceFunctionEntry0( CMTPSVCGETSERVICEINFO_CMTPSVCGETSERVICEINFO_DES_ENTRY );
    39 	delete iServiceInfo;
    42 	delete iServiceInfo;
    40 	__FLOG(_L8("~CMTPSvcGetServiceInfo - Exit"));
    43 	OstTraceFunctionExit0( CMTPSVCGETSERVICEINFO_CMTPSVCGETSERVICEINFO_DES_EXIT );
    41 	__FLOG_CLOSE;
       
    42 	}
    44 	}
    43 
    45 
    44 CMTPSvcGetServiceInfo::CMTPSvcGetServiceInfo(MMTPDataProviderFramework& aFramework, MMTPConnection& aConnection, 
    46 CMTPSvcGetServiceInfo::CMTPSvcGetServiceInfo(MMTPDataProviderFramework& aFramework, MMTPConnection& aConnection, 
    45 											MMTPServiceDataProvider& aDataProvider) :
    47 											MMTPServiceDataProvider& aDataProvider) :
    46 	CMTPRequestProcessor(aFramework, aConnection, 0, NULL), iDataProvider(aDataProvider)
    48 	CMTPRequestProcessor(aFramework, aConnection, 0, NULL), iDataProvider(aDataProvider)
    47 	{	
    49 	{	
    48 	}
    50 	}
    49 
    51 
    50 void CMTPSvcGetServiceInfo::ConstructL()
    52 void CMTPSvcGetServiceInfo::ConstructL()
    51 	{
    53 	{
    52 	__FLOG_OPEN(KMTPSubsystem, KComponent);
    54 	OstTraceFunctionEntry0( CMTPSVCGETSERVICEINFO_CONSTRUCTL_ENTRY );
    53 	__FLOG(_L8("ConstructL - Entry")); 
       
    54 	iServiceInfo = CMTPTypeServiceInfo::NewL();
    55 	iServiceInfo = CMTPTypeServiceInfo::NewL();
    55 	__FLOG(_L8("ConstructL - Exit")); 
    56 	OstTraceFunctionExit0( CMTPSVCGETSERVICEINFO_CONSTRUCTL_EXIT );
    56 	}
    57 	}
    57 
    58 
    58 TMTPResponseCode CMTPSvcGetServiceInfo::CheckRequestL()
    59 TMTPResponseCode CMTPSvcGetServiceInfo::CheckRequestL()
    59 	{
    60 	{
    60 	__FLOG(_L8("CheckRequestL - Entry"));
    61 	OstTraceFunctionEntry0( CMTPSVCGETSERVICEINFO_CHECKREQUESTL_ENTRY );
    61 	TMTPResponseCode responseCode = CMTPRequestProcessor::CheckRequestL();
    62 	TMTPResponseCode responseCode = CMTPRequestProcessor::CheckRequestL();
    62 	if (EMTPRespCodeOK == responseCode)
    63 	if (EMTPRespCodeOK == responseCode)
    63 		{
    64 		{
    64 		TUint32 serviceId = Request().Uint32(TMTPTypeRequest::ERequestParameter1);
    65 		TUint32 serviceId = Request().Uint32(TMTPTypeRequest::ERequestParameter1);
    65 		if (serviceId != iDataProvider.ServiceID())
    66 		if (serviceId != iDataProvider.ServiceID())
    66 			{
    67 			{
    67 			responseCode  = EMTPRespCodeInvalidServiceID;
    68 			responseCode  = EMTPRespCodeInvalidServiceID;
    68 			}
    69 			}
    69 		}
    70 		}
    70 	__FLOG_VA((_L8("CheckRequestL - Exit with response code = 0x%04X"), responseCode));
    71     OstTrace1( TRACE_NORMAL, CMTPSVCGETSERVICEINFO_CHECKREQUESTL, "Exit with response code = 0x%04X", responseCode );   
       
    72 	OstTraceFunctionExit0( CMTPSVCGETSERVICEINFO_CHECKREQUESTL_EXIT );
    71 	return responseCode;
    73 	return responseCode;
    72 	}
    74 	}
    73 
    75 
    74 void CMTPSvcGetServiceInfo::ServiceL()
    76 void CMTPSvcGetServiceInfo::ServiceL()
    75 	{
    77 	{
    76 	__FLOG(_L8("ServiceL - Entry"));
    78 	OstTraceFunctionEntry0( CMTPSVCGETSERVICEINFO_SERVICEL_ENTRY );
    77 	iResponseCode = (iDataProvider.ServiceHandler())->GetServiceInfoL(*iServiceInfo);
    79 	iResponseCode = (iDataProvider.ServiceHandler())->GetServiceInfoL(*iServiceInfo);
    78 	SendDataL(*iServiceInfo);
    80 	SendDataL(*iServiceInfo);
    79 	__FLOG(_L8("ServiceL - Exit"));
    81 	OstTraceFunctionExit0( CMTPSVCGETSERVICEINFO_SERVICEL_EXIT );
    80 	}
    82 	}
    81 
    83 
    82 TBool CMTPSvcGetServiceInfo::DoHandleResponsePhaseL()
    84 TBool CMTPSvcGetServiceInfo::DoHandleResponsePhaseL()
    83 	{
    85 	{
    84 	__FLOG(_L8("DoHandleResponsePhaseL - Entry"));
    86 	OstTraceFunctionEntry0( CMTPSVCGETSERVICEINFO_DOHANDLERESPONSEPHASEL_ENTRY );
    85 	TMTPResponseCode responseCode = (iCancelled ? EMTPRespCodeIncompleteTransfer : iResponseCode);
    87 	TMTPResponseCode responseCode = (iCancelled ? EMTPRespCodeIncompleteTransfer : iResponseCode);
    86 	SendResponseL(responseCode);
    88 	SendResponseL(responseCode);
    87 	__FLOG_VA((_L8("DoHandleResponsePhaseL - Exit with Response Code: 0x%x"), iResponseCode));
    89     OstTrace1( TRACE_NORMAL, CMTPSVCGETSERVICEINFO_DOHANDLERESPONSEPHASEL, "Exit with response code = 0x%04X", iResponseCode );  	
       
    90 	OstTraceFunctionExit0( CMTPSVCGETSERVICEINFO_DOHANDLERESPONSEPHASEL_EXIT );
    88 	return EFalse;
    91 	return EFalse;
    89 	}
    92 	}