os/kernelhwsrv/kerneltest/e32test/usbho/t_usbdi/inc/controlendpointreader.h
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
sl@0
     1
#ifndef __CONTROL_ENDPOINT_READER_H
sl@0
     2
#define __CONTROL_ENDPOINT_READER_H
sl@0
     3
sl@0
     4
/*
sl@0
     5
* Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
sl@0
     6
* All rights reserved.
sl@0
     7
* This component and the accompanying materials are made available
sl@0
     8
* under the terms of the License "Eclipse Public License v1.0"
sl@0
     9
* which accompanies this distribution, and is available
sl@0
    10
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0
    11
*
sl@0
    12
* Initial Contributors:
sl@0
    13
* Nokia Corporation - initial contribution.
sl@0
    14
*
sl@0
    15
* Contributors:
sl@0
    16
*
sl@0
    17
* Description:
sl@0
    18
* @file controlendpointreader.h
sl@0
    19
* @internalComponent
sl@0
    20
* 
sl@0
    21
*
sl@0
    22
*/
sl@0
    23
sl@0
    24
sl@0
    25
sl@0
    26
#include "endpointreader.h"
sl@0
    27
sl@0
    28
namespace NUnitTesting_USBDI
sl@0
    29
	{
sl@0
    30
sl@0
    31
/**
sl@0
    32
*/
sl@0
    33
class MRequestHandler
sl@0
    34
	{
sl@0
    35
public:
sl@0
    36
	/**
sl@0
    37
	Called when a control vendor request from the host is received and does not require data being
sl@0
    38
	sent back to the host.
sl@0
    39
	@param aRequest the control request value
sl@0
    40
	@param aValue a parameter value for the request
sl@0
    41
	@param aIndex an index parameter for the request
sl@0
    42
	@param aDataReqLength the length of the data to be returned to the host
sl@0
    43
	@param aPayload the data payload sent to the device by the host in a data phase
sl@0
    44
	*/
sl@0
    45
	
sl@0
    46
	virtual TInt ProcessRequestL(TUint8 aRequest,TUint16 aValue,TUint16 aIndex,TUint16 aDataReqLength,
sl@0
    47
					const TDesC8& aPayload) = 0;
sl@0
    48
	};
sl@0
    49
sl@0
    50
sl@0
    51
	
sl@0
    52
/**
sl@0
    53
This class describes a entity that reads control requests from endpoint 0
sl@0
    54
*/
sl@0
    55
class CControlEndpointReader : public CEndpointReader, public MEndpointDataHandler
sl@0
    56
	{
sl@0
    57
public:
sl@0
    58
sl@0
    59
	/**
sl@0
    60
	Constructor, build a reader of requests from endpoint zero
sl@0
    61
	@param aClientDriver the channel to the USB client driver
sl@0
    62
	@param aRequestHandler the handler of control requests
sl@0
    63
	*/
sl@0
    64
	
sl@0
    65
	CControlEndpointReader(RDevUsbcClient& aClientDriver,MRequestHandler& aRequestHandler);
sl@0
    66
	
sl@0
    67
	/**
sl@0
    68
	Destructor
sl@0
    69
	*/
sl@0
    70
	
sl@0
    71
	virtual ~CControlEndpointReader();
sl@0
    72
sl@0
    73
	/**
sl@0
    74
	Reads requests sent by the host on endpoint 0.  This includes any data from the data phase
sl@0
    75
	of the transfer
sl@0
    76
	*/
sl@0
    77
	
sl@0
    78
	void ReadRequestsL();
sl@0
    79
sl@0
    80
public: // From MEndpointDataHandler
sl@0
    81
sl@0
    82
	/**
sl@0
    83
	Interprets the data received as a control request on endpoint 0
sl@0
    84
	@param aEndpointNumber the number of the endpoint read from
sl@0
    85
	@param aData the data successfully read from the endpoint
sl@0
    86
	*/
sl@0
    87
	
sl@0
    88
	virtual void DataReceivedFromEndpointL(TEndpointNumber aEndpointNumber,const TDesC8& aData);	
sl@0
    89
	
sl@0
    90
	/**
sl@0
    91
	Notified when an error occurs on a read from the endpoint
sl@0
    92
	@param aEndpointNumber the number of the endpoint read from
sl@0
    93
	@param aErrorCode the read operation completion error
sl@0
    94
	*/
sl@0
    95
	
sl@0
    96
	void EndpointReadError(TEndpointNumber aEndpointNumber,TInt aErrorCode);
sl@0
    97
	
sl@0
    98
private:
sl@0
    99
sl@0
   100
	// Flag to indicate
sl@0
   101
	TBool iDeviceToHost;
sl@0
   102
	TBool iDataPhase;
sl@0
   103
	
sl@0
   104
	/**
sl@0
   105
	The request status of the entity processing requests
sl@0
   106
	*/
sl@0
   107
	MRequestHandler& iRequestHandler;
sl@0
   108
	
sl@0
   109
	/**
sl@0
   110
	The fields of the control transfer request
sl@0
   111
	*/
sl@0
   112
	TUint8 ibRequestType;
sl@0
   113
	TUint8 ibRequest;
sl@0
   114
	TUint16 iwValue;
sl@0
   115
	TUint16 iwIndex;
sl@0
   116
	TUint16 iwLength;
sl@0
   117
	};
sl@0
   118
	
sl@0
   119
	}
sl@0
   120
sl@0
   121
sl@0
   122
#endif
sl@0
   123
sl@0
   124