satengine/SatServer/Engine/inc/CSatBIPDataSender.h
changeset 46 2fa1fa551b0b
parent 42 35488577e233
child 48 78df25012fda
equal deleted inserted replaced
42:35488577e233 46:2fa1fa551b0b
     1 /*
       
     2 * Copyright (c) 2002-2005 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:  CSatBIPDataSender is responsible of Send operations
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef CSATBIPDATASENDER_H
       
    21 #define CSATBIPDATASENDER_H
       
    22 
       
    23 //  INCLUDES
       
    24 #include    <e32base.h>
       
    25 #include    <in_sock.h>
       
    26 #include    "MSatBIPUtils.h"
       
    27 
       
    28 // FORWARD DECLARATIONS
       
    29 class MSatSendDataObserver;
       
    30 
       
    31 // CLASS DECLARATION
       
    32 
       
    33 /**
       
    34 *  CSatBIPDataSender is responsible for sending data using deifned protocol and
       
    35 *  to notify MSatSendDataObserver when data has been sent.
       
    36 *
       
    37 *  @lib SatEngine.lib
       
    38 *  @since Series 60 3.0
       
    39 */
       
    40 class CSatBIPDataSender : public CActive
       
    41     {
       
    42     public:  // Constructors and destructor
       
    43 
       
    44         /**
       
    45         * Default constructor.
       
    46         * @param aObserver Observer of successfull send data
       
    47         * @param aSocket Socket where the data is sent
       
    48         * @param aIsTcpSocket Indicates wheter to use TCP or UDP
       
    49         * @param aBufferSize Size of Tx buffer. Sent back to aObserver
       
    50         */
       
    51         CSatBIPDataSender( MSatSendDataObserver& aObserver,
       
    52                            RSocket& aSocket,
       
    53                            TBool aIsTcpSocket,
       
    54                            TInt aBufferSize );
       
    55 
       
    56         /**
       
    57         * Destructor.
       
    58         */
       
    59         virtual ~CSatBIPDataSender();
       
    60 
       
    61     public: // Functions from base classes
       
    62 
       
    63         /**
       
    64         * From CActive. Informs observer that data has been sent.
       
    65         */
       
    66         void RunL();
       
    67 
       
    68         /**
       
    69         * From CActive. Cancels any outgoing requests
       
    70         */
       
    71         void DoCancel();
       
    72 
       
    73     public: // New functions
       
    74 
       
    75         /**
       
    76         * Sends data using predefined protocol.
       
    77         * @param aData Data to send.
       
    78         * @param aDest Destination address where the data is sent. Used only
       
    79         *        with UDP sockets.
       
    80         */
       
    81         void SendData( const TDesC8& aData, TInetAddr& aDest );
       
    82 
       
    83     private:    // Data
       
    84 
       
    85         // Observer the data sent event.
       
    86         MSatSendDataObserver& iObserver;
       
    87 
       
    88         // Socket
       
    89         RSocket& iSocket;
       
    90 
       
    91         // Defines wether to use UDP or TCP sockets
       
    92         TBool iIsTcpSocket;
       
    93 
       
    94         // Holds the amount of data sent with same connection
       
    95         TUint iUplinkData;
       
    96 
       
    97         // Sender buffer
       
    98         TBuf8<KSatBIPMaxBufferSize> iSendPtr;
       
    99 
       
   100         // Buffer size. Returned to observer when data is sent
       
   101         TInt iBufferSize;
       
   102 
       
   103     };
       
   104 
       
   105 #endif      // CSATBIPDATASENDER_H
       
   106 
       
   107 // End of File