FConnection Class Reference

This class is a singleton, used to manage the network connection. More...

#include <FConnection.h>

Collaboration diagram for FConnection:

Collaboration graph
[legend]
List of all members.

Public Member Functions

virtual ~FConnection ()
 Destructor. Closes the connection and the session.
const int startConnection ()
 Starts a new GPRS connection using the default IAP, which name is stored in the member 'iIAPDefaultName'.
const int startConnection (const StringBuffer &aIAPName)
 Starts a new GPRS connection, given the IAP name.
void closeConnection ()
 Closes the active connection.
const int stopConnection ()
 Stops the entire connection by disconnecting the underlying network interface immediately, regardless of whether other clients are using it or not.
const bool isConnected ()
 Checks if the connection is active or down.
const StringBuffer & getLocalIpAddress ()
 Returns the local IP address of the device.
void setIAPName (const StringBuffer &aIAPName)
 Sets the IAP name, that will be used in startConnection().
StringBuffer & getIAPName ()
 Returns the current IAP name.
RArray< HBufC * > GetAllIAPNames ()
 Returns an array of (new allocated) descriptors, with all the current IAP names.
RConnection * getConnection ()
 Returns a pointer to the (internally owned) RConnection.
RSocketServ * getSession ()
 Returns a pointer to the (internally owned) SocketServ.
TInt getLastError ()
 Returns the last error code.

Static Public Member Functions

static FConnectiongetInstance ()
 Method to get the sole instance of FConnection.
static void dispose ()
 Method to destroy the instance of FConnection.

Protected Member Functions

 FConnection ()
 Default constructor.

Detailed Description

This class is a singleton, used to manage the network connection.

Get the only instance of FConnection calling FConnection::getInstance(). Owns the RSocketServ and RConnection of the current connection, that can be used exterally calling getConnection() and getSession().


Member Function Documentation

const int FConnection::startConnection (  ) 

Starts a new GPRS connection using the default IAP, which name is stored in the member 'iIAPDefaultName'.

The method setIAPDefaultName() should be called before this method, to set the IAP to be used - otherwise, the user will be prompted to select the IAP.

Returns:
0 if no error

const int FConnection::startConnection ( const StringBuffer &  aIAPName  ) 

Starts a new GPRS connection, given the IAP name.

Parameters:
aIAPName "Ask" or "" : if we want to prompt the user to select the IAP "Default" : will use the default IAP of the system, no prompts "<name>" : will use the <name> IAP, no prompts. If not found, will prompt the user to select the IAP
Returns:
0 if no error

void FConnection::closeConnection (  ) 

Closes the active connection.

The connection will not be dropped immediately: it will be dropped when there is no more data traffic on the connection.

Note:
If a client needs to shutdown the connection in a hard way, then use stopConnection() instead of this method.

const int FConnection::stopConnection (  ) 

Stops the entire connection by disconnecting the underlying network interface immediately, regardless of whether other clients are using it or not.

Applications using the connection will be sent the socket error code KErrCancel.

Note:
If a client needs to graciously shutdown the connection, closeConnection() should be used instead of this method.
Returns:
0 if no error

const bool FConnection::isConnected (  ) 

Checks if the connection is active or down.

Between active connection, we search for the one started with startConnection().

Returns:
true if connection is active

const StringBuffer& FConnection::getLocalIpAddress (  ) 

Returns the local IP address of the device.

TODO

void FConnection::setIAPName ( const StringBuffer &  aIAPName  )  [inline]

Sets the IAP name, that will be used in startConnection().

This method should be called at the beginning, so that subsequent calls to startConnection() will use this IAP.

Parameters:
aIAPName the name of the IAP

RArray<HBufC*> FConnection::GetAllIAPNames (  ) 

Returns an array of (new allocated) descriptors, with all the current IAP names.

The caller has the ownership of the array, so he should take care of deleting it (calling Close()).


The documentation for this class was generated from the following file:
Generated on Wed Jan 14 17:15:45 2009 for Funambol C++ Client Library by  doxygen 1.5.2