DESERT 4.0.0
UwConnector Class Referenceabstract

#include <uwconnector.h>

Inheritance diagram for UwConnector:
Inheritance graph
Collaboration diagram for UwConnector:
Collaboration graph

Public Member Functions

 UwConnector ()
 
virtual ~UwConnector ()
 
virtual void setServer ()
 
virtual void setTCP ()
 
virtual void setUDP ()
 
virtual bool openConnection (const std::string &path)=0
 
virtual bool closeConnection ()=0
 
virtual int writeToDevice (const std::string &msg)=0
 
virtual int readFromDevice (void *wpos, int maxlen)=0
 
virtual const int getErrno ()
 
virtual const bool isConnected ()=0
 

Protected Attributes

int local_errno
 

Detailed Description

Class UwConnector allows to specify an interface between the UwDriver object and the device. The connector is typically a TCP or UDP connection, but may also be a serial connection. It allows to retrieve the data packets received by the transducer and to send commands to it. UwConnector assumes the connector works on a byte-based flow.

Constructor & Destructor Documentation

◆ UwConnector()

UwConnector::UwConnector ( )
inline

UwConnector constructor

Parameters
addressstring representing an address, whatever that is

◆ ~UwConnector()

virtual UwConnector::~UwConnector ( )
inlinevirtual

UwConnector destructor

Member Function Documentation

◆ closeConnection()

virtual bool UwConnector::closeConnection ( )
pure virtual

Method that closes an active connection to a device interface

Returns
boolean true if connection is correctly closed, false otherwise

Implemented in UwSerial, and UwSocket.

◆ getErrno()

virtual const int UwConnector::getErrno ( )
inlinevirtual

Function that retrieves the last saved errno code: to be implemented

Returns
error code from <cerrno> system library

References local_errno.

◆ isConnected()

virtual const bool UwConnector::isConnected ( )
pure virtual

Returns true if connection is up

Returns
if connection is up

Implemented in UwSerial, and UwSocket.

◆ openConnection()

virtual bool UwConnector::openConnection ( const std::string &  path)
pure virtual

Method that opens up a connection to a device. This method can open a conection with the modem's data/config interface or directly to some remote host at the end of the connection. @path string representing the path to connect to: its meaning depends on the type of connection established

Returns
boolean true if connection is correctly opened, false otherwise

Implemented in UwSerial, and UwSocket.

◆ readFromDevice()

virtual int UwConnector::readFromDevice ( void *  wpos,
int  maxlen 
)
pure virtual

Function that dumps data from the device's memory to data char array. The downloaded data is saved to a temporary buffer, to be later parsed.

Parameters
poschar pointer to the beginning of the writable area; it is duty of the caller to take care of the writable area
maxlenmaximum integer number of char to write to wpos
Returns
number of bytes read in a single dump

Implemented in UwSerial, and UwSocket.

◆ setServer()

virtual void UwConnector::setServer ( )
inlinevirtual

Method required in client-server connection (e.g. TCP)

Reimplemented in UwSocket.

◆ setTCP()

virtual void UwConnector::setTCP ( )
inlinevirtual

Method that should set, for a socket connector, the TCP transport protocol. To be left untouched by other types of connectors.

Reimplemented in UwSocket.

◆ setUDP()

virtual void UwConnector::setUDP ( )
inlinevirtual

Method that should set, for a socket connector, the UDP transport protocol. To be left untouched by other types of connectors.

Reimplemented in UwSocket.

◆ writeToDevice()

virtual int UwConnector::writeToDevice ( const std::string &  msg)
pure virtual

Function that writes some command to the connected interface

Parameters
cmdstring command to write to the device
Returns
boolean true if command is correctly written to the device

Implemented in UwSerial, and UwSocket.

Member Data Documentation

◆ local_errno


The documentation for this class was generated from the following file: