29 #ifndef UR_CLIENT_LIBRARY_SCRIPT_SENDER_H_INCLUDED 30 #define UR_CLIENT_LIBRARY_SCRIPT_SENDER_H_INCLUDED 83 if (std::string(buffer) == PROGRAM_REQUEST_)
92 size_t len = program_.size();
93 const uint8_t* data =
reinterpret_cast<const uint8_t*
>(program_.c_str());
96 if (server_.
write(filedescriptor, data, len, written))
110 #endif // UR_CLIENT_LIBRARY_SCRIPT_SENDER_H_INCLUDED void setDisconnectCallback(std::function< void(const int)> func)
This callback will be triggered on clients disconnecting from the server.
ScriptSender(uint32_t port, const std::string &program)
Creates a ScriptSender object, including a new TCPServer.
#define URCL_LOG_ERROR(...)
std::thread script_thread_
void messageCallback(const int filedescriptor, char *buffer)
void connectionCallback(const int filedescriptor)
void setConnectCallback(std::function< void(const int)> func)
This callback will be triggered on clients connecting to the server.
Wrapper class for a TCP socket server.
void start()
Start event handling.
#define URCL_LOG_DEBUG(...)
const std::string PROGRAM_REQUEST_
bool write(const int fd, const uint8_t *buf, const size_t buf_len, size_t &written)
Writes to a client.
void disconnectionCallback(const int filedescriptor)
The ScriptSender class starts a TCPServer for a robot to connect to and waits for a request to receiv...
#define URCL_LOG_INFO(...)
void setMessageCallback(std::function< void(const int, char *)> func)
This callback will be triggered on messages received on the socket.
void sendProgram(const int filedescriptor)