From 74e5eccbc3d1784d4d016499225865560e653af1 Mon Sep 17 00:00:00 2001 From: Romain Reignier Date: Sun, 11 Mar 2018 00:00:43 +0100 Subject: [PATCH] Add getter for hardware and getter for the IP address --- src/ros_lib/RosQtSocket.cpp | 5 +++++ src/ros_lib/ros/RosQtSocket.h | 8 +++++--- src/ros_lib/ros/node_handle.h | 5 +++++ 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/ros_lib/RosQtSocket.cpp b/src/ros_lib/RosQtSocket.cpp index 2ef6e1a..e3286e2 100644 --- a/src/ros_lib/RosQtSocket.cpp +++ b/src/ros_lib/RosQtSocket.cpp @@ -87,6 +87,11 @@ unsigned long RosQtSocket::time() return static_cast(QDateTime::currentMSecsSinceEpoch()); } +QString RosQtSocket::getAddress() const +{ + return address_.toString(); +} + void RosQtSocket::onConnected() { socket_.setSocketOption(QAbstractSocket::LowDelayOption, 1); diff --git a/src/ros_lib/ros/RosQtSocket.h b/src/ros_lib/ros/RosQtSocket.h index 4dfb26e..19f7103 100644 --- a/src/ros_lib/ros/RosQtSocket.h +++ b/src/ros_lib/ros/RosQtSocket.h @@ -1,9 +1,9 @@ /** Software License Agreement (BSD) -\file RosQtSocket.h -\authors Robin Vanhove -\copyright Copyright (c) 2017, Robopec, All rights reserved. +\file WindowsSocket.h +\authors Kareem Shehata +\copyright Copyright (c) 2014, Clearpath Robotics, Inc., All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: @@ -53,6 +53,8 @@ class RosQtSocket : public QObject unsigned long time (); + QString getAddress() const; + private slots: void onConnected(); diff --git a/src/ros_lib/ros/node_handle.h b/src/ros_lib/ros/node_handle.h index 8c87087..681d951 100644 --- a/src/ros_lib/ros/node_handle.h +++ b/src/ros_lib/ros/node_handle.h @@ -108,6 +108,11 @@ class NodeHandle : public NodeHandleBase_ /* Disconnect from server */ void close(); + RosQtSocket& getHardware() + { + return hardware_; + } + protected: //State machine variables for spinOnce int mode_;