|
DESERT 4.0.0
|
#include <uwsocket.h>


Public Types | |
| enum class | Transport { TCP = 0 , UDP } |
Public Member Functions | |
| UwSocket () | |
| virtual | ~UwSocket () |
| virtual bool | openConnection (const std::string &path) |
| virtual bool | closeConnection () |
| virtual const bool | isConnected () |
| virtual int | writeToDevice (const std::string &msg) |
| virtual int | readFromDevice (void *wpos, int maxlen) |
| virtual void | setTCP () |
| virtual void | setUDP () |
| virtual void | setServer () |
Public Member Functions inherited from UwConnector | |
| UwConnector () | |
| virtual | ~UwConnector () |
| virtual const int | getErrno () |
Private Attributes | |
| int | socketfd |
| Transport | proto |
| bool | isClient |
| struct sockaddr_in | cl_addr |
Additional Inherited Members | |
Protected Attributes inherited from UwConnector | |
| int | local_errno |
Class that implements a TCP or UDP socket. For each UwSocket object, a thread is spawned and dedicated to reading the socket buffer ans retrieving data: while sending is done in the calling thread.
|
strong |
| UwSocket::UwSocket | ( | ) |
Constructor of the UwSocket class
References UwConnector::local_errno.
|
virtual |
Destructor of the UwSocket class
|
virtual |
Method that closes an active connection to a device
Implements UwConnector.
References socketfd.
|
virtual |
Returns true if socket fd differs from -1, that means the connection is up
Implements UwConnector.
References socketfd.
|
virtual |
Method that opens a TCP or UDP connection, accordinto to UwSocket::proto variable: the behavior depends both on the transport protocol selected and the path specified in the constructor parameter. If TCP is set:
Implements UwConnector.
References cl_addr, isClient, UwConnector::local_errno, proto, sep, socketfd, TCP, and udp_init_string.
|
virtual |
Function that dumps data from the device's memory to a backup buffer. The unloaded data is saved to a temporary buffer, to be parsed later.
| pos | position to start writing data to: a pointer to some buffer |
Implements UwConnector.
|
inlinevirtual |
|
inlinevirtual |
Method that sets TCP as transport protocol
Reimplemented from UwConnector.
|
inlinevirtual |
Method that sets UDP as transport protocol
Reimplemented from UwConnector.
|
virtual |
Method that writes a command to the modem interface
| msg | std::string command to be sent to the device |
Implements UwConnector.
|
private |
Referenced by openConnection(), readFromDevice(), and writeToDevice().
|
private |
Bool value that defines the role of the socket
Referenced by openConnection(), and setServer().
|
private |
Transport protocol to be used: either Transport::TCP or Transport::UDP.
Referenced by openConnection(), readFromDevice(), setTCP(), setUDP(), and writeToDevice().
|
private |
Integer value that stores the socket descriptor as generated by the function UwSocket::openConnection().
Referenced by closeConnection(), isConnected(), openConnection(), readFromDevice(), and writeToDevice().