mtpfws/mtpfw/dataproviders/dputility/src/cmtpsvcgetservicepropdesc.cpp
changeset 47 63cf70d3ecd8
parent 0 d0791faffa3f
equal deleted inserted replaced
44:a5deb6b96675 47:63cf70d3ecd8
    18 #include <mtp/cmtptypeservicepropdesclist.h>
    18 #include <mtp/cmtptypeservicepropdesclist.h>
    19 
    19 
    20 #include "cmtpsvcgetservicepropdesc.h"
    20 #include "cmtpsvcgetservicepropdesc.h"
    21 #include "mmtpservicedataprovider.h"
    21 #include "mmtpservicedataprovider.h"
    22 #include "mmtpservicehandler.h"
    22 #include "mmtpservicehandler.h"
       
    23 #include "OstTraceDefinitions.h"
       
    24 #ifdef OST_TRACE_COMPILER_IN_USE
       
    25 #include "cmtpsvcgetservicepropdescTraces.h"
       
    26 #endif
    23 
    27 
    24 __FLOG_STMT(_LIT8(KComponent,"SvcGetSvcPDesc");)
       
    25 
    28 
    26 EXPORT_C MMTPRequestProcessor* CMTPSvcGetServicePropDesc::NewL(MMTPDataProviderFramework& aFramework, MMTPConnection& aConnection, MMTPServiceDataProvider& aDataProvider)
    29 EXPORT_C MMTPRequestProcessor* CMTPSvcGetServicePropDesc::NewL(MMTPDataProviderFramework& aFramework, MMTPConnection& aConnection, MMTPServiceDataProvider& aDataProvider)
    27 	{
    30 	{
    28 	CMTPSvcGetServicePropDesc* self = new (ELeave) CMTPSvcGetServicePropDesc(aFramework, aConnection, aDataProvider);
    31 	CMTPSvcGetServicePropDesc* self = new (ELeave) CMTPSvcGetServicePropDesc(aFramework, aConnection, aDataProvider);
    29 	CleanupStack::PushL(self);
    32 	CleanupStack::PushL(self);
    32 	return self;
    35 	return self;
    33 	}
    36 	}
    34 
    37 
    35 EXPORT_C CMTPSvcGetServicePropDesc::~CMTPSvcGetServicePropDesc()
    38 EXPORT_C CMTPSvcGetServicePropDesc::~CMTPSvcGetServicePropDesc()
    36 	{
    39 	{
    37 	__FLOG(_L8("~CMTPSvcGetServicePropDesc - Entry"));
    40 	OstTraceFunctionEntry0( CMTPSVCGETSERVICEPROPDESC_CMTPSVCGETSERVICEPROPDESC_ENTRY );
    38 	delete iPropDescList;
    41 	delete iPropDescList;
    39 	__FLOG(_L8("~CMTPSvcGetServicePropDesc - Exit"));
    42 	OstTraceFunctionExit0( CMTPSVCGETSERVICEPROPDESC_CMTPSVCGETSERVICEPROPDESC_EXIT );
    40 	__FLOG_CLOSE;
       
    41 	}
    43 	}
    42 
    44 
    43 CMTPSvcGetServicePropDesc::CMTPSvcGetServicePropDesc(MMTPDataProviderFramework& aFramework, MMTPConnection& aConnection, MMTPServiceDataProvider& aDataProvider) :
    45 CMTPSvcGetServicePropDesc::CMTPSvcGetServicePropDesc(MMTPDataProviderFramework& aFramework, MMTPConnection& aConnection, MMTPServiceDataProvider& aDataProvider) :
    44 	CMTPRequestProcessor(aFramework, aConnection, 0, NULL),
    46 	CMTPRequestProcessor(aFramework, aConnection, 0, NULL),
    45 	iDataProvider(aDataProvider),
    47 	iDataProvider(aDataProvider),
    47 	{
    49 	{
    48 	}
    50 	}
    49 
    51 
    50 void CMTPSvcGetServicePropDesc::ConstructL()
    52 void CMTPSvcGetServicePropDesc::ConstructL()
    51 	{
    53 	{
    52 	__FLOG_OPEN(KMTPSubsystem, KComponent);
    54 	OstTraceFunctionEntry0( CMTPSVCGETSERVICEPROPDESC_CONSTRUCTL_ENTRY );
    53 	__FLOG(_L8("ConstructL - Entry"));
       
    54 	iPropDescList = CMTPTypeServicePropDescList::NewL();
    55 	iPropDescList = CMTPTypeServicePropDescList::NewL();
    55 	__FLOG(_L8("ConstructL - Exit"));
    56 	OstTraceFunctionExit0( CMTPSVCGETSERVICEPROPDESC_CONSTRUCTL_EXIT );
    56 	}
    57 	}
    57 
    58 
    58 TMTPResponseCode CMTPSvcGetServicePropDesc::CheckRequestL()
    59 TMTPResponseCode CMTPSvcGetServicePropDesc::CheckRequestL()
    59 	{
    60 	{
    60 	__FLOG(_L8("CheckRequestL - Entry"));
    61 	OstTraceFunctionEntry0( CMTPSVCGETSERVICEPROPDESC_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 		TUint32 propCode(Request().Uint32(TMTPTypeRequest::ERequestParameter2));
    66 		TUint32 propCode(Request().Uint32(TMTPTypeRequest::ERequestParameter2));
    66 		
    67 		
    67 		if ((iDataProvider.ServiceID() != serviceID))
    68 		if ((iDataProvider.ServiceID() != serviceID))
    68 			{
    69 			{
    69 			responseCode = EMTPRespCodeInvalidServiceID;
    70 			responseCode = EMTPRespCodeInvalidServiceID;
    70 			__FLOG(_L8("Service Id Parameter don't be supported"));
    71 			OstTrace0( TRACE_WARNING, DUP1_CMTPSVCGETSERVICEPROPDESC_CHECKREQUESTL, "Service Id Parameter don't be supported" );
    71 			}
    72 			}
    72 		
    73 		
    73 		if (EMTPRespCodeOK == responseCode)
    74 		if (EMTPRespCodeOK == responseCode)
    74 			{
    75 			{
    75 			if ((KMTPNotSpecified32 != propCode) && 
    76 			if ((KMTPNotSpecified32 != propCode) && 
    76 				!(iDataProvider.IsValidServicePropCodeL(propCode)))
    77 				!(iDataProvider.IsValidServicePropCodeL(propCode)))
    77 				{
    78 				{
    78 				responseCode = EMTPRespCodeInvalidServicePropCode;
    79 				responseCode = EMTPRespCodeInvalidServicePropCode;
    79 				__FLOG(_L8("Service Object PropCode Parameter don't be supported"));
    80 				OstTrace0( TRACE_WARNING, DUP2_CMTPSVCGETSERVICEPROPDESC_CHECKREQUESTL, "Service Object PropCode Parameter don't be supported" );
    80 				}
    81 				}
    81 			}
    82 			}
    82 		}
    83 		}
    83 	__FLOG_VA((_L8("CheckRequestL - Exit with response code = 0x%04X"), responseCode));
    84     OstTrace1( TRACE_NORMAL, CMTPSVCGETSERVICEPROPDESC_CHECKREQUESTL, "Exit with response code = 0x%04X", responseCode );	
       
    85 	OstTraceFunctionExit0( CMTPSVCGETSERVICEPROPDESC_CHECKREQUESTL_EXIT );
    84 	return responseCode;
    86 	return responseCode;
    85 	}
    87 	}
    86 
    88 
    87 void CMTPSvcGetServicePropDesc::ServiceL()
    89 void CMTPSvcGetServicePropDesc::ServiceL()
    88 	{
    90 	{
    89 	__FLOG(_L8("ServiceL - Entry"));
    91 	OstTraceFunctionEntry0( CMTPSVCGETSERVICEPROPDESC_SERVICEL_ENTRY );
    90 	TUint32 propCode = Request().Uint32(TMTPTypeRequest::ERequestParameter2);
    92 	TUint32 propCode = Request().Uint32(TMTPTypeRequest::ERequestParameter2);
    91 	
    93 	
    92 	if (KMTPNotSpecified32 != propCode)
    94 	if (KMTPNotSpecified32 != propCode)
    93 		{
    95 		{
    94 		iResponseCode = (iDataProvider.ServiceHandler())->GetServicePropDescL(propCode, *iPropDescList);
    96 		iResponseCode = (iDataProvider.ServiceHandler())->GetServicePropDescL(propCode, *iPropDescList);
   104 			iResponseCode = (iDataProvider.ServiceHandler())->GetServicePropDescL(propCodeArray[i], *iPropDescList);
   106 			iResponseCode = (iDataProvider.ServiceHandler())->GetServicePropDescL(propCodeArray[i], *iPropDescList);
   105 			}
   107 			}
   106 		CleanupStack::PopAndDestroy(&propCodeArray);
   108 		CleanupStack::PopAndDestroy(&propCodeArray);
   107 		}
   109 		}
   108 	SendDataL(*iPropDescList);
   110 	SendDataL(*iPropDescList);
   109 	__FLOG_VA((_L8("ServiceL - Exit with Response Code: 0x%x, Service Property Count: %u"), iResponseCode, iPropDescList->NumberOfElements()));
   111     OstTraceExt2( TRACE_NORMAL, CMTPSVCGETSERVICEPROPDESC_SERVICEL, 
       
   112             "Exit with Response Code: 0x%x, Service Property Count: %u", iResponseCode, iPropDescList->NumberOfElements());
       
   113 	OstTraceFunctionExit0( CMTPSVCGETSERVICEPROPDESC_SERVICEL_EXIT );
   110 	}
   114 	}
   111 
   115 
   112 TBool CMTPSvcGetServicePropDesc::DoHandleResponsePhaseL()
   116 TBool CMTPSvcGetServicePropDesc::DoHandleResponsePhaseL()
   113 	{
   117 	{
   114 	__FLOG(_L8("DoHandleResponsePhaseL - Entry"));
   118 	OstTraceFunctionEntry0( CMTPSVCGETSERVICEPROPDESC_DOHANDLERESPONSEPHASEL_ENTRY );
   115 	TMTPResponseCode responseCode = (iCancelled ? EMTPRespCodeIncompleteTransfer : iResponseCode);
   119 	TMTPResponseCode responseCode = (iCancelled ? EMTPRespCodeIncompleteTransfer : iResponseCode);
   116 	SendResponseL(responseCode);
   120 	SendResponseL(responseCode);
   117 	__FLOG_VA((_L8("DoHandleResponsePhaseL - Exit with Response Code: 0x%x"), iResponseCode));
   121     OstTrace1( TRACE_NORMAL, CMTPSVCGETSERVICEPROPDESC_DOHANDLERESPONSEPHASEL, "Exit with Response Code: 0x%x", iResponseCode );	
       
   122 	OstTraceFunctionExit0( CMTPSVCGETSERVICEPROPDESC_DOHANDLERESPONSEPHASEL_EXIT );
       
   123 	
   118 	return EFalse;
   124 	return EFalse;
   119 	}
   125 	}
   120 
   126