satengine/SatServer/inc/MSatBIPDataChannel.h
changeset 46 2fa1fa551b0b
parent 42 35488577e233
child 48 78df25012fda
equal deleted inserted replaced
42:35488577e233 46:2fa1fa551b0b
     1 /*
       
     2 * Copyright (c) 2002-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 "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:  Interface for BIP Data channel.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef MSATBIPDATACHANNEL_H
       
    21 #define MSATBIPDATACHANNEL_H
       
    22 
       
    23 //  INCLUDES
       
    24 #include <e32std.h>
       
    25 #include <etelsat.h>
       
    26 #include <extendedconnpref.h> // TExtendedConnPref
       
    27 
       
    28 // CLASS DECLARATION
       
    29 class MSatSendDataObserver;
       
    30 class MSatConnectionObserver;
       
    31 /**
       
    32 *  Interface for BIP Data channel.
       
    33 *
       
    34 *  @lib SatEngine
       
    35 *  @since Series 60 3.0
       
    36 */
       
    37 class MSatBIPDataChannel
       
    38     {
       
    39 
       
    40     public: // Structs
       
    41 
       
    42         // Contains all the information needed to establish connection.
       
    43         // Parameters are common to all bearers
       
    44         struct TSatBipConnectionInfo
       
    45             {
       
    46             RSat::TSimMeInterface iProtocol;     // TCP or UDP, port number
       
    47             RSat::TOtherAddress   iDestination;  // Dest. address, IPv4 or IPv6
       
    48             TUint16               iBufferSize;   // Size of the receive buffer
       
    49             TExtendedConnPref*    iOverrideSet;  // extended connection
       
    50             RSat::TBearerParams   iBearerParams; // QoS parameters
       
    51             RSat::TOtherAddress   iSource;       // Local addr, IPv4 or IPv6
       
    52             TUint32               iCreatedApnId; // ID of the created APN
       
    53             };
       
    54 
       
    55     public: // New functions
       
    56 
       
    57         /**
       
    58         * Sets up connection. Does not activate it yet.
       
    59         * @param aConnParams includes all needed information to
       
    60         *        open the connection.
       
    61         */
       
    62         virtual void SetupConnectionL(
       
    63             const TSatBipConnectionInfo& aConnParams ) = 0;
       
    64 
       
    65         /**
       
    66         * Activates connection. Connection information must be set before
       
    67         * activating connection
       
    68         * @param aObserver Observer of the connection
       
    69         */
       
    70         virtual void ActivateConnectionL( 
       
    71             MSatConnectionObserver* aObserver ) = 0;
       
    72         
       
    73         /**
       
    74         * From MSatBIPDataChannel Returns Negotiated bearer parameters
       
    75         * @param aResult Output Negotiated bearer parameters
       
    76         */
       
    77         virtual void GetNegotiatedQoSParams( 
       
    78             RSat::TBearerParams& aResult ) const = 0;
       
    79         
       
    80         /**
       
    81         * Sends the data or stores it into a buffer for later send.
       
    82         * @param aData Data to be send.
       
    83         * @param aSendImmedeately Indicates whether to send immediately or
       
    84         *        store data to buffer for later send.
       
    85         * @param aFreeBufferSize The number of bytes of empty size in the buffer
       
    86         * @param aObserver Observer of the completion of data send.
       
    87         * @return Error code indicating the status of the command execution.
       
    88         */
       
    89         virtual TInt SendDataL( const TDes8& aData,
       
    90                                 const TBool aSendImmediately,
       
    91                                 TInt& aFreeBufferSize,
       
    92                                 MSatSendDataObserver* aObserver ) = 0;
       
    93 
       
    94         /**
       
    95         * Receives the data from the buffer.
       
    96         * @param aData Data to receive.
       
    97         * @param aBytesToRead The number of requested bytes to return
       
    98         * @param aAvailableBytes Number of unread bytes left in the buffer.
       
    99         * @return Error code indicating the status of the command execution.
       
   100         */
       
   101         virtual TInt ReceiveDataL( TDes8& aData,
       
   102                                    const TInt aBytesToRead,
       
   103                                    TInt& aAvailableBytes ) = 0;
       
   104 
       
   105         /**
       
   106         * Returns the ID of this data channel.
       
   107         * @return ID of this channel.
       
   108         */
       
   109         virtual TInt ChannelId() const = 0;
       
   110 
       
   111         /**
       
   112         * Returns the ID of this data channel to ChannelStatus
       
   113         * @return ID that can be placed to ChannelStatus
       
   114         */
       
   115         virtual TUint8 ChannelStatusChannelId() const = 0;
       
   116 
       
   117         /**
       
   118         * Returns the status of this channel.
       
   119         * @return Status of this data channel
       
   120         */
       
   121         virtual TInt Status() const = 0;
       
   122 
       
   123         /**
       
   124         * Closes the connection and empties the buffers.
       
   125         */
       
   126         virtual void CloseChannel() = 0;
       
   127 
       
   128         /**
       
   129         * Cancels all actions.
       
   130         */
       
   131         virtual void CancelAll() = 0;
       
   132 
       
   133         /**
       
   134         * Indicates whether PDP contex is active or not.
       
   135         * @return TBool indicating context activation.
       
   136         */
       
   137         virtual TBool IsContextActive() const = 0;
       
   138         
       
   139         /**
       
   140         * Returns connection information
       
   141         * @return Connection information
       
   142         */
       
   143         virtual const TSatBipConnectionInfo& ConnInfo() const = 0;
       
   144        
       
   145         /**
       
   146         * Close udp socket.
       
   147         */
       
   148         virtual void StopUdpSocket() = 0;
       
   149 
       
   150         /**
       
   151         * Destructor.
       
   152         */
       
   153         virtual ~MSatBIPDataChannel() {};
       
   154 
       
   155     protected:  // Constructors and destructor
       
   156 
       
   157         /**
       
   158         * Constructor.
       
   159         */
       
   160         MSatBIPDataChannel() {};
       
   161 
       
   162     private:
       
   163 
       
   164         // Assign operator
       
   165         MSatBIPDataChannel& operator=( const MSatBIPDataChannel& );
       
   166 
       
   167         // Prohibit copy constructor if not deriving from CBase.
       
   168         MSatBIPDataChannel( const MSatBIPDataChannel& );
       
   169     };
       
   170 
       
   171 #endif      // MSATBIPDATACHANNEL_H
       
   172 
       
   173 // End of File