kerneltest/e32test/usbho/t_usbdi/inc/Ep0Reader.h
changeset 0 a41df078684a
equal deleted inserted replaced
-1:000000000000 0:a41df078684a
       
     1 #ifndef __EP0_READER_H
       
     2 #define __EPO_READER_H
       
     3 
       
     4 /*
       
     5 * Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     6 * All rights reserved.
       
     7 * This component and the accompanying materials are made available
       
     8 * under the terms of the License "Eclipse Public License v1.0"
       
     9 * which accompanies this distribution, and is available
       
    10 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
    11 *
       
    12 * Initial Contributors:
       
    13 * Nokia Corporation - initial contribution.
       
    14 *
       
    15 * Contributors:
       
    16 *
       
    17 * Description:
       
    18 * @file Ep0Reader.h
       
    19 * @internalComponent
       
    20 * 
       
    21 *
       
    22 */
       
    23 
       
    24 
       
    25 
       
    26 #include "controlendpointreader.h"
       
    27 #include "endpointwriter.h"
       
    28 
       
    29 namespace NUnitTesting_USBDI
       
    30 	{
       
    31 
       
    32 /**
       
    33 This class describes a processor for device directed requests and associated data
       
    34 payload packets
       
    35 */
       
    36 class CDeviceEndpoint0 : public CBase
       
    37 	{
       
    38 public:
       
    39 	
       
    40 	/**
       
    41 	Constructor (2-phase) 
       
    42 	@return a pointer to a new instance of control Ep0 reader
       
    43 	*/
       
    44 	
       
    45 	static CDeviceEndpoint0* NewL(MRequestHandler& aRequestHandler);
       
    46 	
       
    47 	/**
       
    48 	Destructor
       
    49 	*/
       
    50 	
       
    51 	~CDeviceEndpoint0();
       
    52 
       
    53 	/**
       
    54 	Starts this reader receiving device directed ep0 requests
       
    55 	@return KErrNone if successful or system wide error code
       
    56 	*/
       
    57 
       
    58 	TInt Start();
       
    59 
       
    60 	/**
       
    61 	Stops this reader receiving device directed ep0 requests
       
    62 	@return KErrNone if successful or system wide error code
       
    63 	*/
       
    64 	TInt Stop();
       
    65 	
       
    66 	/**
       
    67 	Send data back to the host through endpoint 0
       
    68 	@param aData the descriptor with the data to send back
       
    69 	*/
       
    70 	void SendData(const TDesC8& aData);
       
    71 
       
    72 	/**
       
    73 	Send data back to the host through endpoint 0 and do not return until completion
       
    74 	@param aData the descriptor with the data to send back
       
    75 	*/
       
    76 	TInt SendDataSynchronous(const TDesC8& aData);
       
    77 	
       
    78 	/**
       
    79 	Access the reader object for this control endpoint 0
       
    80 	*/
       
    81 	CControlEndpointReader& Reader();
       
    82 	
       
    83 private:
       
    84 	
       
    85 	/**
       
    86 	Constructor, build a reader for control endpoint 0
       
    87 	*/
       
    88 	
       
    89 	CDeviceEndpoint0();
       
    90 	
       
    91 	/**
       
    92 	2nd phase constructor
       
    93 	*/
       
    94 	
       
    95 	void ConstructL(MRequestHandler& aRequestHandler);
       
    96 
       
    97 private:
       
    98 	
       
    99 	/**
       
   100 	The channel to the USB client driver
       
   101 	*/
       
   102 	
       
   103 	RDevUsbcClient iClientDriver;
       
   104 	
       
   105 	/**
       
   106 	The endpoint reader for endpoint 0
       
   107 	*/
       
   108 	
       
   109 	CControlEndpointReader* iEndpoint0Reader;
       
   110 		
       
   111 	/**
       
   112 	The endpoint writer for endpoint 0
       
   113 	*/
       
   114 	
       
   115 	CEndpointWriter* iEndpoint0Writer;
       
   116 	};
       
   117 		
       
   118 	}
       
   119 
       
   120 #endif
       
   121 
       
   122