script_sender.h
Go to the documentation of this file.
1 
2 // this is for emacs file handling -*- mode: c++; indent-tabs-mode: nil -*-
3 
4 // -- BEGIN LICENSE BLOCK ----------------------------------------------
5 // Copyright 2019 FZI Forschungszentrum Informatik
6 // Created on behalf of Universal Robots A/S
7 //
8 // Licensed under the Apache License, Version 2.0 (the "License");
9 // you may not use this file except in compliance with the License.
10 // You may obtain a copy of the License at
11 //
12 // http://www.apache.org/licenses/LICENSE-2.0
13 //
14 // Unless required by applicable law or agreed to in writing, software
15 // distributed under the License is distributed on an "AS IS" BASIS,
16 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 // See the License for the specific language governing permissions and
18 // limitations under the License.
19 // -- END LICENSE BLOCK ------------------------------------------------
20 
21 //----------------------------------------------------------------------
28 //----------------------------------------------------------------------
29 
30 #ifndef UR_CLIENT_LIBRARY_SCRIPT_SENDER_H_INCLUDED
31 #define UR_CLIENT_LIBRARY_SCRIPT_SENDER_H_INCLUDED
32 
33 #include <thread>
34 #include <string>
35 
37 #include "ur_client_library/log.h"
38 
39 namespace urcl
40 {
41 namespace control
42 {
48 {
49 public:
50  ScriptSender() = delete;
57  ScriptSender(uint32_t port, const std::string& program);
58 
59 private:
61  std::thread script_thread_;
62  std::string program_;
63 
64  const std::string PROGRAM_REQUEST_ = std::string("request_program\n");
65 
66  void connectionCallback(const socket_t filedescriptor);
67 
68  void disconnectionCallback(const socket_t filedescriptor);
69 
70  void messageCallback(const socket_t filedescriptor, char* buffer);
71 
72  void sendProgram(const socket_t filedescriptor);
73 };
74 
75 } // namespace control
76 } // namespace urcl
77 
78 #endif // UR_CLIENT_LIBRARY_SCRIPT_SENDER_H_INCLUDED
urcl::control::ScriptSender::sendProgram
void sendProgram(const socket_t filedescriptor)
Definition: src/control/script_sender.cpp:63
urcl::control::ScriptSender::PROGRAM_REQUEST_
const std::string PROGRAM_REQUEST_
Definition: script_sender.h:64
urcl::control::ScriptSender::messageCallback
void messageCallback(const socket_t filedescriptor, char *buffer)
Definition: src/control/script_sender.cpp:54
socket_t
int socket_t
Definition: socket_t.h:57
urcl::control::ScriptSender
The ScriptSender class starts a TCPServer for a robot to connect to and waits for a request to receiv...
Definition: script_sender.h:47
urcl
Definition: bin_parser.h:36
urcl::control::ScriptSender::connectionCallback
void connectionCallback(const socket_t filedescriptor)
Definition: src/control/script_sender.cpp:44
urcl::control::ScriptSender::disconnectionCallback
void disconnectionCallback(const socket_t filedescriptor)
Definition: src/control/script_sender.cpp:49
urcl::control::ScriptSender::script_thread_
std::thread script_thread_
Definition: script_sender.h:61
urcl::control::ScriptSender::ScriptSender
ScriptSender()=delete
urcl::comm::TCPServer
Wrapper class for a TCP socket server.
Definition: tcp_server.h:58
log.h
urcl::control::ScriptSender::program_
std::string program_
Definition: script_sender.h:62
urcl::control::ScriptSender::server_
comm::TCPServer server_
Definition: script_sender.h:60
tcp_server.h


ur_client_library
Author(s): Thomas Timm Andersen, Simon Rasmussen, Felix Exner, Lea Steffen, Tristan Schnell
autogenerated on Mon May 26 2025 02:35:58