27 #ifndef UR_ROBOT_DRIVER_DASHBOARD_CLIENT_DASHBOARD_CLIENT_H_INCLUDED 28 #define UR_ROBOT_DRIVER_DASHBOARD_CLIENT_DASHBOARD_CLIENT_H_INCLUDED 81 virtual bool open(
int socket_fd,
struct sockaddr* address,
size_t address_len)
83 return ::connect(socket_fd, address, address_len) == 0;
87 bool send(
const std::string& text);
90 void rtrim(std::string& str,
const std::string& chars =
"\t\n\v\f\r ")
92 str.erase(str.find_last_not_of(chars) + 1);
100 #endif // ifndef UR_ROBOT_DRIVER_DASHBOARD_CLIENT_DASHBOARD_CLIENT_H_INCLUDED bool send(const std::string &text)
void rtrim(std::string &str, const std::string &chars="\t\n\v\f\r ")
virtual ~DashboardClient()=default
std::string sendAndReceive(const std::string &command)
Sends a command through the socket and waits for an answer.
const int DASHBOARD_SERVER_PORT
bool connect()
Opens a connection to the dasboard server on the host as specified in the constructor.
Class for TCP socket abstraction.
virtual bool open(int socket_fd, struct sockaddr *address, size_t address_len)
This class is a wrapper around the dashboard server.
void disconnect()
Makes sure no connection to the dashboard server is held inside the object.