mtpfws/mtpfw/dataproviders/dputility/src/cmtprequestprocessor.cpp
changeset 49 c20dd21d1eb4
parent 20 6e82ae192c3a
equal deleted inserted replaced
41:2c19c7cf5550 49:c20dd21d1eb4
    20 #include <mtp/mmtpconnection.h>
    20 #include <mtp/mmtpconnection.h>
    21 #include <mtp/mmtpobjectmgr.h>
    21 #include <mtp/mmtpobjectmgr.h>
    22 
    22 
    23 #include "cmtprequestprocessor.h"
    23 #include "cmtprequestprocessor.h"
    24 #include "cmtprequestchecker.h"
    24 #include "cmtprequestchecker.h"
       
    25 #include "OstTraceDefinitions.h"
       
    26 #ifdef OST_TRACE_COMPILER_IN_USE
       
    27 #include "cmtprequestprocessorTraces.h"
       
    28 #endif
       
    29 
    25 const static TInt KNullBufferSize = 4096;
    30 const static TInt KNullBufferSize = 4096;
    26 __FLOG_STMT(_LIT8(KComponent,"MTPRequestProcessor");)
       
    27 
    31 
    28 /**
    32 /**
    29 Standard c++ constructor
    33 Standard c++ constructor
    30 @param aFramework	The data provider framework
    34 @param aFramework	The data provider framework
    31 @param aConnection	The connection from which the request comes
    35 @param aConnection	The connection from which the request comes
    43 	iConnection(aConnection),
    47 	iConnection(aConnection),
    44 	iElementCount(aElementCount),
    48 	iElementCount(aElementCount),
    45 	iElements(aElements)
    49 	iElements(aElements)
    46 	{
    50 	{
    47 	CActiveScheduler::Add(this);
    51 	CActiveScheduler::Add(this);
    48 	__FLOG_OPEN(KMTPSubsystem, KComponent);
       
    49 	}
    52 	}
    50 
    53 
    51 /**
    54 /**
    52 Destructor
    55 Destructor
    53 */	
    56 */	
    54 EXPORT_C CMTPRequestProcessor::~CMTPRequestProcessor()
    57 EXPORT_C CMTPRequestProcessor::~CMTPRequestProcessor()
    55 	{
    58 	{
       
    59 	OstTraceFunctionEntry0( CMTPREQUESTPROCESSOR_CMTPREQUESTPROCESSOR_DES_ENTRY );
    56 	Cancel();
    60 	Cancel();
    57 	iNullBuffer.Close();
    61 	iNullBuffer.Close();
    58 	delete iRequestChecker;
    62 	delete iRequestChecker;
    59 	__FLOG_CLOSE;
    63 	OstTraceFunctionExit0( CMTPREQUESTPROCESSOR_CMTPREQUESTPROCESSOR_DES_EXIT );
    60 	}
    64 	}
    61 
    65 
    62 /**
    66 /**
    63 Relese (delete) this request processor
    67 Relese (delete) this request processor
    64 */	
    68 */	
   242 Handle the request phase of the current request
   246 Handle the request phase of the current request
   243 @return EFalse
   247 @return EFalse
   244 */
   248 */
   245 EXPORT_C TBool CMTPRequestProcessor::DoHandleRequestPhaseL()
   249 EXPORT_C TBool CMTPRequestProcessor::DoHandleRequestPhaseL()
   246 	{
   250 	{
   247 	__FLOG(_L8("DoHandleRequestPhaseL - Entry."));
   251 	OstTraceFunctionEntry0( CMTPREQUESTPROCESSOR_DOHANDLEREQUESTPHASEL_ENTRY );
   248 	TRAPD(err, iResponseCode = CheckRequestL());
   252 	TRAPD(err, iResponseCode = CheckRequestL());
   249 	if ((err != KErrNone) || (iResponseCode != EMTPRespCodeOK))
   253 	if ((err != KErrNone) || (iResponseCode != EMTPRespCodeOK))
   250 		{
   254 		{
   251 		if (HasDataphase()) 
   255 		if (HasDataphase()) 
   252 			{
   256 			{
   253 			// If we have a dataphase
   257 			// If we have a dataphase
   254 			// we need to read in the data and discard it
   258 			// we need to read in the data and discard it	
   255 			__FLOG(_L8("Response code is not OK, there is data phase."));			
   259 			OstTrace0( TRACE_NORMAL, CMTPREQUESTPROCESSOR_DOHANDLEREQUESTPHASEL, 
       
   260 			        "Response code is not OK, there is data phase." );
   256 			iNullBuffer.Close();
   261 			iNullBuffer.Close();
   257 			iNullBuffer.CreateMaxL(KNullBufferSize);
   262 			iNullBuffer.CreateMaxL(KNullBufferSize);
   258 			iNull.SetBuffer(iNullBuffer);
   263 			iNull.SetBuffer(iNullBuffer);
   259 			ReceiveDataL(iNull);
   264 			ReceiveDataL(iNull);
   260 			}
   265 			}
   261 		else
   266 		else
   262 			{
   267 			{
   263 			if(err != KErrNone)
   268 			if(err != KErrNone)
   264 				{
   269 				{
       
   270                 OstTraceExt2( TRACE_ERROR, DUP1_CMTPREQUESTPROCESSOR_DOHANDLEREQUESTPHASEL, 
       
   271 			        "Can't deal with CheckRequestL error! error code %d, responseCode %d", err, iResponseCode);
   265 				User::Leave(err);
   272 				User::Leave(err);
   266 				}
   273 				}
   267 			SendResponseL(TMTPResponseCode(iResponseCode));
   274 			SendResponseL(TMTPResponseCode(iResponseCode));
   268 			}
   275 			}
   269 		}
   276 		}
   282 				iNull.SetBuffer(iNullBuffer);			
   289 				iNull.SetBuffer(iNullBuffer);			
   283 				ReceiveDataL(iNull);		
   290 				ReceiveDataL(iNull);		
   284 				}
   291 				}
   285 			else
   292 			else
   286 				{
   293 				{
       
   294                 OstTrace1( TRACE_ERROR, DUP2_CMTPREQUESTPROCESSOR_DOHANDLEREQUESTPHASEL, 
       
   295                     "Can't deal with ServiceL error! error code %d", err);
   287 				User::Leave(err);
   296 				User::Leave(err);
   288 				}			
   297 				}			
   289 			}
   298 			}
   290 		}
   299 		}
   291 	__FLOG(_L8("DoHandleRequestPhaseL - Exit."));	
   300 	OstTraceFunctionExit0( CMTPREQUESTPROCESSOR_DOHANDLEREQUESTPHASEL_EXIT );
   292 	return EFalse;	
   301 	return EFalse;	
   293 	}
   302 	}
   294 	
   303 	
   295 /**
   304 /**
   296 Handle the receiving data phase of the current request
   305 Handle the receiving data phase of the current request