1 #ifndef CLIENT_COMMUNICATIONS_H 2 #define CLIENT_COMMUNICATIONS_H 13 #include <yarp/os/Bottle.h> 14 #include <yarp/os/RpcClient.h> 15 #include <yarp/os/Port.h> 16 #include <yarp/os/Network.h> 17 #include <yarp/os/Log.h> 18 #include <yarp/os/LogStream.h> 19 #include <yarp/os/PortReader.h> 20 #include <yarp/os/ConnectionReader.h> 21 #include <yarp/os/Time.h> 33 using TaskPortMap = std::map<std::string, std::shared_ptr<yarp::os::RpcClient> >;
46 bool open(
double timeout = 20.0,
bool connectToTasks =
true);
60 void close(
const std::string& taskName);
69 virtual bool read(yarp::os::ConnectionReader& connection);
110 yarp::os::Bottle
queryController(
const std::vector<SERVER_COMMUNICATIONS_MESSAGE> requestVector);
125 std::shared_ptr<yarp::os::RpcClient>
getTaskClient(
const std::string& taskName);
145 virtual bool read(yarp::os::ConnectionReader& connection);
150 bool openServerConnections(
double timeout=20.0);
151 bool openTaskConnections();
154 yarp::os::RpcClient rpcClientPort;
155 yarp::os::Port inputPort;
157 std::string rpcClientPort_Name;
158 std::string inputPort_Name;
161 static int CONTROLLER_CLIENT_COUNT;
163 yarp::os::Network yarp;
166 TaskPortMap taskRpcClients;
173 #endif // CLIENT_COMMUNICATIONS_H void parseMessage(yarp::os::Bottle &input)
virtual ~ClientCommunications()
std::vector< std::string > getTaskTypes()
yarp::os::Bottle queryController(yarp::os::Bottle &requestBottle)
std::vector< std::string > getTaskNames()
#define DEFINE_CLASS_POINTER_TYPEDEFS(Class)
virtual bool read(yarp::os::ConnectionReader &connection)
bool parseInput(yarp::os::Bottle &input)
bool open(double timeout=20.0, bool connectToTasks=true)
std::string getClientPortName()
std::vector< std::string > getTaskPortNames()
std::shared_ptr< yarp::os::RpcClient > getTaskClient(const std::string &taskName)
std::string getTaskPortName(const std::string &taskName)
SERVER_COMMUNICATIONS_MESSAGE