usbengines/usbdevcon/inc/cep0reader.h
changeset 0 1e05558e2206
child 87 18fe5224f0dc
equal deleted inserted replaced
-1:000000000000 0:1e05558e2206
       
     1 /*
       
     2 * Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  State, while waiting for requests
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef CEP0READER_H
       
    20 #define CEP0READER_H
       
    21 
       
    22 #include "cusbdevcon.h"
       
    23 
       
    24 class CStateMachine;    // gets notifications on events happened on EP0
       
    25 
       
    26 /**
       
    27  *  EP0 Reader
       
    28  *
       
    29  *  @lib usbdevcon.lib
       
    30  *  @since S60 v.5.0 
       
    31  */
       
    32  
       
    33 class CEP0Reader : public CActive 
       
    34     {
       
    35 
       
    36 public:
       
    37 
       
    38     /**
       
    39      * Two-phased constructor.
       
    40      *
       
    41      * @since S60 v.5.0
       
    42      * @param aObserver Gets notification when Read request is completed
       
    43      * @param aLdd Link to services for reading EP0
       
    44      * @return Constructed instance
       
    45      */
       
    46     static CEP0Reader* NewL(CStateMachine& aObserver, RDevUsbcClient& aLdd);
       
    47     
       
    48     /**
       
    49     * Destructor.
       
    50     *
       
    51     * @since S60 v.5.0
       
    52     */
       
    53     virtual ~CEP0Reader();
       
    54     
       
    55     /**
       
    56      * Set request to read setup packet
       
    57      *
       
    58      * @since S60 v.5.0
       
    59      */
       
    60     void ReadSetupPacket();
       
    61     
       
    62     /**
       
    63      * Set request to read EP0 data
       
    64      *
       
    65      * @since S60 v.5.0
       
    66      * @param aDataLength Max length of data to read
       
    67      */
       
    68     void Read(TUint aDataLength);
       
    69     
       
    70 private:
       
    71     
       
    72     /**
       
    73      * Default construction
       
    74      *
       
    75      * @since S60 v.5.0
       
    76      * @param aObserver Gets notification when Read request is completed
       
    77      * @param aLdd Link to services for reading EP0
       
    78      */
       
    79     CEP0Reader(CStateMachine& aObserver, RDevUsbcClient& aLdd);
       
    80     
       
    81     /**
       
    82      * Two-phased construction.
       
    83      *
       
    84      */
       
    85     void ConstructL();
       
    86     
       
    87     // from CActive
       
    88     
       
    89     /**
       
    90      * From CActive.
       
    91      *
       
    92      */
       
    93     void RunL();
       
    94     
       
    95     /**
       
    96      * From CActive.
       
    97      *
       
    98      */ 
       
    99     void DoCancel();
       
   100     
       
   101     /**
       
   102      * From CActive.
       
   103      *
       
   104      */ 
       
   105      TInt RunError( TInt /*aError*/ );
       
   106 
       
   107 private: // data
       
   108     
       
   109     /**
       
   110      * LDD Logical Device Driver
       
   111      * Not own.  
       
   112      */
       
   113     RDevUsbcClient& iLdd;
       
   114     
       
   115     /**
       
   116      * State machine gets read data
       
   117      * Not own.  
       
   118      */
       
   119     CStateMachine& iObserver;
       
   120     
       
   121     /**
       
   122      * Read buffer
       
   123      */
       
   124     RBuf8 iBuffer;
       
   125         
       
   126     };
       
   127 
       
   128 #endif // CEP0READER_H