mtptransports/mtpptpiptransport/ptpipcontroller/inc/cptpipsockethandler.h
changeset 0 d0791faffa3f
equal deleted inserted replaced
-1:000000000000 0:d0791faffa3f
       
     1 // Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 /**
       
    17  @file
       
    18  @internalComponent
       
    19 */
       
    20 
       
    21 
       
    22 #ifndef CPTPIPSOCKETHANDLER_H_
       
    23 #define CPTPIPSOCKETHANDLER_H_
       
    24 
       
    25 #include <e32base.h>
       
    26 #include <es_sock.h>
       
    27 #include <mtp/mmtptype.h>
       
    28 
       
    29 
       
    30 const TInt KMaxBufSize=64;
       
    31 
       
    32 enum TSocketHandlerState
       
    33 {
       
    34 	EReadState,EWriteState
       
    35 };
       
    36 /*
       
    37  Handles the Common Socket-Operations
       
    38 */
       
    39 class CPTPIPSocketHandler:public CActive
       
    40 {
       
    41   	public:
       
    42   			
       
    43   		static CPTPIPSocketHandler* NewL();
       
    44   		static CPTPIPSocketHandler *NewLC();
       
    45   		~CPTPIPSocketHandler();   		 		
       
    46   		void ReadFromSocket(MMTPType& aData,TRequestStatus& aStatus);
       
    47   		void WriteToSocket(MMTPType& aData,TRequestStatus& aStatus);  		  		
       
    48   		RSocket& Socket();  			 		  				  			      	    
       
    49 		TSocketHandlerState& State();
       
    50   		
       
    51   	private:
       
    52   	
       
    53   		void RunL();
       
    54   		void DoCancel();  		
       
    55   		TInt RunError(TInt aErr);
       
    56   		CPTPIPSocketHandler();
       
    57   		void ConstructL();  		  		  		
       
    58   		  		
       
    59   	private:
       
    60   	
       
    61   		TPtr8 iReceiveChunk;
       
    62   		TPtrC8 iWriteChunk;  		  	  			  		
       
    63   		TRequestStatus* iCallerStatus;
       
    64   		TBool iChunkStatus;  		  				 		  
       
    65   		RSocket iSocket; 
       
    66   		MMTPType* iReadData,*iWriteData;
       
    67   		TSocketHandlerState iState;
       
    68   		TSockXfrLength iLen;
       
    69   		TInt iLength;
       
    70 };
       
    71 
       
    72 
       
    73 #endif /*CPTPIPSOCKETHANDLER_H_*/