satengine/SatServer/Engine/inc/CSatBIPDataReceiver.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:  CSatBIPDataReceiver is responsible of Receive operations
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef CSATBIPDATARECEIVER_H
       
    21 #define CSATBIPDATARECEIVER_H
       
    22 
       
    23 //  INCLUDES
       
    24 #include    <e32base.h>
       
    25 #include    <in_sock.h>
       
    26 #include    "MSatBIPUtils.h"
       
    27 
       
    28 // FORWARD DECLARATIONS
       
    29 class CSatBIPGPRSDataChannel;
       
    30 
       
    31 // CLASS DECLARATION
       
    32 
       
    33 /**
       
    34 *  CSatBIPDataReceiver is responsible for receiving data using deifned protocol
       
    35 *  and to notify CSatBIPGPRSDataChannel when data has been sent.
       
    36 *
       
    37 *  @lib SatEngine.lib
       
    38 *  @since Series 60 3.0
       
    39 */
       
    40 class CSatBIPDataReceiver : public CActive
       
    41     {
       
    42     public:  // Constructors and destructor
       
    43 
       
    44         /**
       
    45         * Default constructor.
       
    46         * @param aObserver GPRS data channel to whom the received data is passed
       
    47         * @param aSocket Socket where the data is received
       
    48         * @param aIsTcpSocket Indicates whether to use TCP or UDP
       
    49         */
       
    50         CSatBIPDataReceiver( CSatBIPGPRSDataChannel& aObserver,
       
    51                              RSocket& aSocket,
       
    52                              TBool aIsTcpSocket );
       
    53 
       
    54         /**
       
    55         * Destructor.
       
    56         */
       
    57         virtual ~CSatBIPDataReceiver();
       
    58 
       
    59     public: // Functions from base classes
       
    60 
       
    61         /**
       
    62         * From CActive. Informs observer that data has been received.
       
    63         */
       
    64         void RunL();
       
    65 
       
    66         /**
       
    67         * From CActive. Cancels any outgoing requests
       
    68         */
       
    69         void DoCancel();
       
    70 
       
    71     public: // New functions
       
    72 
       
    73         /**
       
    74         * This notification is called when SIM has received all the data
       
    75         * from ReceiveStore in case of UDP. If there are any pending datagrams,
       
    76         * it is stored and receive is available again.
       
    77         */
       
    78         void ReceiveStoreEmptyNotificationL();
       
    79 
       
    80         /**
       
    81         * Starts receiving data using predefined protocol.
       
    82         * @param aAddr Source address where the data is received.
       
    83         */
       
    84         void StartReceive( TInetAddr& aAddr );
       
    85 
       
    86     private:    // Data
       
    87 
       
    88         // Observer the data sent event.
       
    89         CSatBIPGPRSDataChannel& iObserver;
       
    90 
       
    91         // Socket
       
    92         RSocket& iSocket;
       
    93 
       
    94         // Defines wether to use UDP or TCP sockets
       
    95         TBool iIsTcpSocket;
       
    96 
       
    97         // Receive buffer where the data is received
       
    98         TBuf8<KSatBIPMinReceiveBufferSize> iRecvBuffer;
       
    99 
       
   100         // Contains the number of bytes received
       
   101         TInt iReceiveDataLen;
       
   102 
       
   103         // Wrapper for bytes received indication
       
   104         TSockXfrLength iRecvPckg;
       
   105     };
       
   106 
       
   107 #endif      // CSATBIPDATARECEIVER_H
       
   108 
       
   109 // End of File