From ae1b79103ce47107d0ff02ab8e4a1876d3fbee93 Mon Sep 17 00:00:00 2001 From: Lorenzo Date: Tue, 3 Dec 2024 11:54:05 +0100 Subject: [PATCH] add port prefix to rpc port name --- .../src/YarpRobotLoggerDevice.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/devices/YarpRobotLoggerDevice/src/YarpRobotLoggerDevice.cpp b/devices/YarpRobotLoggerDevice/src/YarpRobotLoggerDevice.cpp index 2c9a52cd18..fe5e3f05f2 100644 --- a/devices/YarpRobotLoggerDevice/src/YarpRobotLoggerDevice.cpp +++ b/devices/YarpRobotLoggerDevice/src/YarpRobotLoggerDevice.cpp @@ -394,8 +394,19 @@ bool YarpRobotLoggerDevice::open(yarp::os::Searchable& config) return false; } + // open rpc port for YarpRobotLoggerDevice commands + std::string portPrefix{}; + + if (!params->getParameter("port_prefix", portPrefix)) + { + + log()->info("{} The 'port_prefix' is not provided. It willnot be used.", logPrefix); + } + + std::string rpcPortFullName = portPrefix + m_rpcPortName; + this->yarp().attachAsServer(this->m_rpcPort); - if (!m_rpcPort.open(m_rpcPortName)) + if (!m_rpcPort.open(rpcPortFullName)) { log()->error("{} Could not open", logPrefix); return false;