mtpfws/mtpfw/dataproviders/dputility/src/cmtprequestprocessor.cpp
branchRCL_3
changeset 4 60a94a45d437
parent 0 d0791faffa3f
equal deleted inserted replaced
3:8b094906a049 4:60a94a45d437
    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 
       
    26 const static TInt KNullBufferSize = 4096;
    25 const static TInt KNullBufferSize = 4096;
    27 __FLOG_STMT(_LIT8(KComponent,"MTPRequestProcessor");)
    26 __FLOG_STMT(_LIT8(KComponent,"MTPRequestProcessor");)
    28 
    27 
    29 /**
    28 /**
    30 Standard c++ constructor
    29 Standard c++ constructor
    73 @param aResponseCode The response code to send
    72 @param aResponseCode The response code to send
    74 @param aParamCount	The number of parameters
    73 @param aParamCount	The number of parameters
    75 @param aParmas	The pointer to array of parameters
    74 @param aParmas	The pointer to array of parameters
    76 */	
    75 */	
    77 EXPORT_C void CMTPRequestProcessor::SendResponseL(TMTPResponseCode aResponseCode, TInt aParameterCount, TUint32* aParams)
    76 EXPORT_C void CMTPRequestProcessor::SendResponseL(TMTPResponseCode aResponseCode, TInt aParameterCount, TUint32* aParams)
    78 	{
    77     {
    79 	__ASSERT_DEBUG(aParameterCount < TMTPTypeRequest::ENumElements, User::Invariant());
    78     __ASSERT_DEBUG(aParameterCount < TMTPTypeRequest::ENumElements, User::Invariant());
    80     
    79     iResponse.Reset();
    81 	iResponse.SetUint16(TMTPTypeResponse::EResponseCode, aResponseCode);
    80     iResponse.SetUint16(TMTPTypeResponse::EResponseCode, aResponseCode);
    82 		    
       
    83     iResponse.SetUint32(TMTPTypeResponse::EResponseSessionID, iSessionId);
    81     iResponse.SetUint32(TMTPTypeResponse::EResponseSessionID, iSessionId);
    84 	
    82     iResponse.SetUint32(TMTPTypeResponse::EResponseTransactionID, iTransactionCode);
    85 	iResponse.SetUint32(TMTPTypeResponse::EResponseTransactionID, iTransactionCode);
    83     for(TInt i = 0; i < aParameterCount; ++ i)
    86    
    84         {
    87     TInt i = 0;	
    85         iResponse.SetUint32(TMTPTypeResponse::EResponseParameter1 + i, aParams[i]);
    88 	for(i = 0; i < aParameterCount; i++)
    86         }
    89 		{
    87     __ASSERT_DEBUG(iRequest, User::Invariant());
    90 		iResponse.SetUint32(TMTPTypeResponse::EResponseParameter1 + i, aParams[i]);
    88     iFramework.SendResponseL(iResponse, *iRequest, iConnection);
    91 		}
    89     }
    92 
       
    93 	i += TMTPTypeResponse::EResponseParameter1;
       
    94 	while(i <= TMTPTypeResponse::EResponseParameter5)
       
    95 	    {
       
    96 	    iResponse.SetUint32(i, KMTPNotSpecified32);
       
    97 	    i++;
       
    98 	    }
       
    99 
       
   100 	__ASSERT_DEBUG(iRequest, User::Invariant()); 
       
   101 	iFramework.SendResponseL(iResponse, *iRequest, iConnection);
       
   102 	}
       
   103 
    90 
   104 /**
    91 /**
   105 The current active request
    92 The current active request
   106 @return A reference to the current request
    93 @return A reference to the current request
   107 */	
    94 */	
   154 	{
   141 	{
   155 	__ASSERT_DEBUG(iRequest, User::Invariant()); 
   142 	__ASSERT_DEBUG(iRequest, User::Invariant()); 
   156 	iFramework.ReceiveDataL(aData, *iRequest, iConnection);
   143 	iFramework.ReceiveDataL(aData, *iRequest, iConnection);
   157 	}
   144 	}
   158 	
   145 	
       
   146 /**
       
   147 Register self as a pending request
       
   148 */
       
   149 EXPORT_C void CMTPRequestProcessor::RegisterPendingRequest(TUint aTimeOut)
       
   150     {
       
   151     iFramework.RegisterPendingRequest(aTimeOut);
       
   152     }
       
   153 
   159 /**
   154 /**
   160 Handle the request
   155 Handle the request
   161 @param aRequest	The request to be processed
   156 @param aRequest	The request to be processed
   162 @param aPhase	The current transaction phase of the request
   157 @param aPhase	The current transaction phase of the request
   163 @return ETrue if the transaction has completed, otherwise, EFalse
   158 @return ETrue if the transaction has completed, otherwise, EFalse