connectivitylayer/usbphonetlink/usbpnserver_exe/inc/cusbpnisasender.h
changeset 0 63b37f68c1ce
child 5 8ccc39f9d787
equal deleted inserted replaced
-1:000000000000 0:63b37f68c1ce
       
     1 /*
       
     2 * Copyright (c) 2009 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 the License "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: 
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef CUSBPNISASENDER_H
       
    20 #define CUSBPNISASENDER_H
       
    21 
       
    22 //  INCLUDES
       
    23 #include "musbpncontrolobserver.h"
       
    24 
       
    25 #include <e32base.h>    // For CActive
       
    26 
       
    27 // CONSTANTS
       
    28 // MACROS
       
    29 // DATA TYPES
       
    30 // FUNCTION PROTOTYPES
       
    31 // FORWARD DECLARATIONS
       
    32 class MUsbPnBufferListener;
       
    33 class CUsbPnPacket;
       
    34 class RIscApi;
       
    35 
       
    36 // CLASS DECLARATION
       
    37 
       
    38 /**
       
    39 *  Data sender to ISA direction.
       
    40 */
       
    41 class CUsbPnIsaSender : public CActive, public MUsbPnControlObserver
       
    42     {
       
    43     public:  // Constructors and destructor
       
    44 
       
    45         /**
       
    46         * Two-phased constructor.
       
    47         */
       
    48         static CUsbPnIsaSender* NewL( MUsbPnBufferListener&, RIscApi& );
       
    49 
       
    50         /**
       
    51         * Destructor.
       
    52         */
       
    53         ~CUsbPnIsaSender();
       
    54 
       
    55 
       
    56     public: // Functions from base classes
       
    57 
       
    58         /**
       
    59         * From MUsbPnControlObserver. Returns usable circular packet if any.
       
    60         * @return CUsbPnPacket&. Packet for receiver.
       
    61         */
       
    62         CUsbPnPacket& PacketL();
       
    63 
       
    64         /**
       
    65         * From MUsbPnControlObserver. Adds packet to send queue.
       
    66         * @since Series ?XX ?SeriesXX_version
       
    67         * @param ?arg1 ?description
       
    68         * @return ?description
       
    69         */
       
    70         void Send( CUsbPnPacket& aPacket );
       
    71 
       
    72 
       
    73     protected:  // Functions from base classes
       
    74 
       
    75         /**
       
    76         * From CActive
       
    77         */
       
    78         void DoCancel( );
       
    79 
       
    80         /**
       
    81         * From CActive
       
    82         */
       
    83         void RunL( );
       
    84 
       
    85         /**
       
    86         * From CActive
       
    87         */
       
    88         TInt RunError( TInt );
       
    89 
       
    90 
       
    91     private:
       
    92 
       
    93         /**
       
    94         * C++ default constructor.
       
    95         */
       
    96         CUsbPnIsaSender( MUsbPnBufferListener&, RIscApi& );
       
    97 
       
    98         /**
       
    99         * By default Symbian 2nd phase constructor is private.
       
   100         */
       
   101         void ConstructL();
       
   102 
       
   103         /**
       
   104         * Creates packet object.
       
   105         */
       
   106         void AddPacketBufferL( TInt );
       
   107 
       
   108         /**
       
   109         * Sends packet if it is next in line and not already sending.
       
   110         */
       
   111         void TryToSendPacket( CUsbPnPacket& );
       
   112 
       
   113 
       
   114     private:    // Data
       
   115 
       
   116         // Reference to receiver for continuing receive
       
   117         MUsbPnBufferListener&   iBufferListener;
       
   118 
       
   119         // Reference to ISCAPI handle
       
   120         RIscApi&                iIscApi;
       
   121 
       
   122         // Number of packets in queue
       
   123         TUint                   iPacketCount;
       
   124 
       
   125         // Ownership. Newest packet -marker of circular buffer. Packets added to this 'end' of pool.
       
   126         CUsbPnPacket*           iPacket;
       
   127 
       
   128         // Pointer to oldest packet -marker of circular buffer. Packets written from this 'end' of pool.
       
   129         CUsbPnPacket*           iCurrentPacket;
       
   130 
       
   131 
       
   132     };
       
   133 
       
   134 #endif      // CUSBPNISASENDER_H
       
   135 
       
   136 // End of File