Public Member Functions | Public Attributes | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
urcl::DashboardClient Class Reference

This class is a wrapper around the dashboard server. More...

#include <dashboard_client.h>

Inheritance diagram for urcl::DashboardClient:
Inheritance graph
[legend]

Public Member Functions

bool connect ()
 Opens a connection to the dasboard server on the host as specified in the constructor. More...
 
 DashboardClient (const std::string &host)
 Constructor that shall be used by default. More...
 
 DashboardClient ()=delete
 
void disconnect ()
 Makes sure no connection to the dashboard server is held inside the object. More...
 
std::string sendAndReceive (const std::string &command)
 Sends a command through the socket and waits for an answer. More...
 
virtual ~DashboardClient ()=default
 
- Public Member Functions inherited from urcl::comm::TCPSocket
void close ()
 Closes the connection to the socket. More...
 
std::string getIP () const
 Determines the local IP address of the currently configured socket. More...
 
int getSocketFD ()
 Getter for the file descriptor of the socket. More...
 
SocketState getState ()
 Getter for the state of the socket. More...
 
bool read (char *character)
 Reads one byte from the socket. More...
 
bool read (uint8_t *buf, const size_t buf_len, size_t &read)
 Reads data from the socket. More...
 
void setReceiveTimeout (const timeval &timeout)
 Setup Receive timeout used for this socket. More...
 
 TCPSocket ()
 Creates a TCPSocket object. More...
 
bool write (const uint8_t *buf, const size_t buf_len, size_t &written)
 Writes to the socket. More...
 
virtual ~TCPSocket ()
 

Public Attributes

const int DASHBOARD_SERVER_PORT = 29999
 

Protected Member Functions

virtual bool open (int socket_fd, struct sockaddr *address, size_t address_len)
 
- Protected Member Functions inherited from urcl::comm::TCPSocket
virtual void setOptions (int socket_fd)
 
bool setup (std::string &host, int port)
 

Private Member Functions

std::string read ()
 
void rtrim (std::string &str, const std::string &chars="\t\n\v\f\r ")
 
bool send (const std::string &text)
 

Private Attributes

std::string host_
 
int port_
 
std::mutex write_mutex_
 

Additional Inherited Members

- Protected Attributes inherited from urcl::comm::TCPSocket
std::unique_ptr< timeval > recv_timeout_
 

Detailed Description

This class is a wrapper around the dashboard server.

For every Dashboard command there exists a wrapper function that will send the request and wait for the server's response.

For documentation about the dashboard server, please see

Definition at line 44 of file dashboard_client.h.

Constructor & Destructor Documentation

urcl::DashboardClient::DashboardClient ( const std::string &  host)

Constructor that shall be used by default.

Parameters
hostIP address of the robot

Definition at line 35 of file dashboard_client.cpp.

urcl::DashboardClient::DashboardClient ( )
delete
virtual urcl::DashboardClient::~DashboardClient ( )
virtualdefault

Member Function Documentation

bool urcl::DashboardClient::connect ( )

Opens a connection to the dasboard server on the host as specified in the constructor.

Returns
True on successful connection, false otherwise.

Definition at line 39 of file dashboard_client.cpp.

void urcl::DashboardClient::disconnect ( )

Makes sure no connection to the dashboard server is held inside the object.

Definition at line 55 of file dashboard_client.cpp.

virtual bool urcl::DashboardClient::open ( int  socket_fd,
struct sockaddr *  address,
size_t  address_len 
)
inlineprotectedvirtual

Reimplemented from urcl::comm::TCPSocket.

Definition at line 81 of file dashboard_client.h.

std::string urcl::DashboardClient::read ( )
private

Definition at line 69 of file dashboard_client.cpp.

void urcl::DashboardClient::rtrim ( std::string &  str,
const std::string &  chars = "\t\n\v\f\r " 
)
inlineprivate

Definition at line 90 of file dashboard_client.h.

bool urcl::DashboardClient::send ( const std::string &  text)
private

Definition at line 61 of file dashboard_client.cpp.

std::string urcl::DashboardClient::sendAndReceive ( const std::string &  command)

Sends a command through the socket and waits for an answer.

Parameters
commandCommand that will be sent to the server. It is important, that the command sent is finished with a '
' (newline) so it will be processed by the server.
Returns
Answer as received by the server cut off any trailing newlines.

Definition at line 92 of file dashboard_client.cpp.

Member Data Documentation

const int urcl::DashboardClient::DASHBOARD_SERVER_PORT = 29999

Definition at line 56 of file dashboard_client.h.

std::string urcl::DashboardClient::host_
private

Definition at line 95 of file dashboard_client.h.

int urcl::DashboardClient::port_
private

Definition at line 96 of file dashboard_client.h.

std::mutex urcl::DashboardClient::write_mutex_
private

Definition at line 97 of file dashboard_client.h.


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


ur_client_library
Author(s): Thomas Timm Andersen, Simon Rasmussen, Felix Exner, Lea Steffen, Tristan Schnell
autogenerated on Sun May 9 2021 02:16:26