From b090cdf833e8b8b51904018035a593e3b0e5f117 Mon Sep 17 00:00:00 2001 From: Felix Mauch Date: Tue, 9 Apr 2019 13:14:29 +0200 Subject: [PATCH] added shell consumer --- CMakeLists.txt | 1 + include/ur_rtde_driver/comm/shell_consumer.h | 52 ++++++++++++++++++++ src/comm/shell_consumer.cpp | 29 +++++++++++ 3 files changed, 82 insertions(+) create mode 100644 include/ur_rtde_driver/comm/shell_consumer.h create mode 100644 src/comm/shell_consumer.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index cd90cad..2a0a250 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -68,6 +68,7 @@ include_directories( add_library(ur_rtde_driver src/comm/tcp_socket.cpp + src/comm/shell_consumer.cpp #src/ros/service_stopper.cpp #src/ur/commander.cpp #src/ur/master_board.cpp diff --git a/include/ur_rtde_driver/comm/shell_consumer.h b/include/ur_rtde_driver/comm/shell_consumer.h new file mode 100644 index 0000000..1f8c19f --- /dev/null +++ b/include/ur_rtde_driver/comm/shell_consumer.h @@ -0,0 +1,52 @@ +// this is for emacs file handling -*- mode: c++; indent-tabs-mode: nil -*- + +// -- BEGIN LICENSE BLOCK ---------------------------------------------- +// -- END LICENSE BLOCK ------------------------------------------------ + +//---------------------------------------------------------------------- +/*!\file + * + * \author Felix Mauch mauch@fzi.de + * \date 2019-04-09 + * + */ +//---------------------------------------------------------------------- + +#ifndef UR_RTDE_DRIVER_SHELL_CONSUMER_H_INCLUDED +#define UR_RTDE_DRIVER_SHELL_CONSUMER_H_INCLUDED + +#include "ur_rtde_driver/comm/pipeline.h" +#include "ur_rtde_driver/comm/package.h" + +namespace ur_driver +{ +namespace comm +{ +template +class ShellConsumer : public IConsumer> +{ +public: + ShellConsumer() = default; + virtual ~ShellConsumer() = default; + + virtual void setupConsumer() + { + } + virtual void teardownConsumer() + { + } + virtual void stopConsumer() + { + } + virtual void onTimeout() + { + } + + virtual bool consume(std::shared_ptr> product); + +private: + /* data */ +}; +} // namespace comm +} // namespace ur_driver +#endif // ifndef UR_RTDE_DRIVER_SHELL_CONSUMER_H_INCLUDED diff --git a/src/comm/shell_consumer.cpp b/src/comm/shell_consumer.cpp new file mode 100644 index 0000000..b714eae --- /dev/null +++ b/src/comm/shell_consumer.cpp @@ -0,0 +1,29 @@ +// this is for emacs file handling -*- mode: c++; indent-tabs-mode: nil -*- + +// -- BEGIN LICENSE BLOCK ---------------------------------------------- +// -- END LICENSE BLOCK ------------------------------------------------ + +//---------------------------------------------------------------------- +/*!\file + * + * \author Felix Mauch mauch@fzi.de + * \date 2019-04-09 + * + */ +//---------------------------------------------------------------------- + +#include "ur_rtde_driver/comm/shell_consumer.h" + +namespace ur_driver +{ +namespace comm +{ +template +bool ShellConsumer::consume(std::shared_ptr> pkg) +{ + LOG_INFO("%s", pkg->toString()); + return true; +} +} // namespace comm + +} // namespace ur_driver