DESERT 3.5.1
|
#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 () |
![]() | |
UwConnector () | |
virtual | ~UwConnector () |
virtual const int | getErrno () |
Private Attributes | |
int | socketfd |
Transport | proto |
bool | isClient |
struct sockaddr_in | cl_addr |
Additional Inherited Members | |
![]() | |
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.
Definition at line 58 of file uwsocket.h.
|
strong |
Enum structure thet represents the transport protocol being used.
The two possible choices are, of course, TCP or UDP.
Enumerator | |
---|---|
TCP | |
UDP |
Definition at line 66 of file uwsocket.h.
UwSocket::UwSocket | ( | ) |
Constructor of the UwSocket class.
Definition at line 40 of file uwsocket.cpp.
|
virtual |
Destructor of the UwSocket class.
Definition at line 49 of file uwsocket.cpp.
|
virtual |
Method that closes an active connection to a device.
Implements UwConnector.
Definition at line 273 of file uwsocket.cpp.
|
virtual |
Returns true if socket fd differs from -1, that means the connection is up.
Implements UwConnector.
Definition at line 54 of file uwsocket.cpp.
|
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.
Definition at line 60 of file uwsocket.cpp.
|
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.
Definition at line 317 of file uwsocket.cpp.
|
inlinevirtual |
Method that sets SERVER role.
Reimplemented from UwConnector.
Definition at line 139 of file uwsocket.h.
|
inlinevirtual |
Method that sets TCP as transport protocol.
Reimplemented from UwConnector.
Definition at line 122 of file uwsocket.h.
|
inlinevirtual |
Method that sets UDP as transport protocol.
Reimplemented from UwConnector.
Definition at line 130 of file uwsocket.h.
|
virtual |
Method that writes a command to the modem interface.
msg | std::string command to be sent to the device |
Implements UwConnector.
Definition at line 286 of file uwsocket.cpp.
|
private |
Definition at line 162 of file uwsocket.h.
|
private |
Bool value that defines the role of the socket.
Definition at line 157 of file uwsocket.h.
|
private |
Transport protocol to be used: either Transport::TCP or Transport::UDP.
Definition at line 153 of file uwsocket.h.
|
private |
Integer value that stores the socket descriptor as generated by the function UwSocket::openConnection().
Definition at line 149 of file uwsocket.h.