YARP
Yet Another Robot Platform
 
Loading...
Searching...
No Matches
yarpbroker.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2006-2021 Istituto Italiano di Tecnologia (IIT)
3 * SPDX-License-Identifier: BSD-3-Clause
4 */
5
6#ifndef YARP_MANAGER_YARPBROKER
7#define YARP_MANAGER_YARPBROKER
8
9#include <string>
10#include <iostream>
11#include <yarp/os/Time.h>
12#include <yarp/os/Port.h>
14#include <yarp/os/Network.h>
15#include <yarp/os/Property.h>
16#include <string>
17#include <yarp/os/Semaphore.h>
19
20// FIXME Do not use yarp/os/impl in .h files
21#include <yarp/os/SystemInfo.h>
23
24#include <yarp/manager/broker.h>
26
27namespace yarp::manager {
28
29
34
35public:
36 YarpBroker();
37 ~YarpBroker() override;
38 bool init() override;
39 bool init(const char* szcmd, const char* szparam,
40 const char* szhost, const char* szstdio,
41 const char* szworkdir, const char* szenv ) override;
42 void fini() override;
43 bool start() override;
44 bool stop() override;
45 bool kill() override;
46 bool connect(const std::string& from, const std::string& to, const std::string& carrier, bool persist = false) override;
47 bool disconnect(const std::string& from, const std::string& to, const std::string& carrier) override;
48 bool rmconnect(const std::string& from, const std::string& to);
49 int running() override;
50 bool exists(const std::string& port) override;
51 std::string requestRpc(const std::string& szport, const std::string& request, double timeout) override;
52 bool connected(const std::string& from, const std::string& to, const std::string& carrier) override;
53 std::string error() override;
54 bool initialized() override { return bInitialized;}
55 bool attachStdout() override;
56 void detachStdout() override;
57
58 bool getSystemInfo(const std::string& server,
60 bool getAllProcesses(const std::string& server,
61 ProcessContainer &processes);
62 bool getAllPorts(std::vector<std::string> &stingList);
63
64 bool setQos(const std::string& from, const std::string& to, const std::string& qosFrom, const std::string& qosTo);
65
66public: // for rate thread
67 void run() override;
68 bool threadInit() override;
69 void threadRelease() override;
70
71protected:
72
73private:
74 std::string strCmd;
75 std::string strParam;
76 std::string strHost;
77 std::string strStdio;
78 std::string strWorkdir;
79 std::string strTag;
80 std::string strEnv;
81 unsigned int ID;
82 yarp::os::Property command;
83 std::string strError;
84 bool bOnlyConnector;
85 bool bInitialized;
86 yarp::os::Semaphore semParam;
87 std::string strStdioUUID;
88 std::string __trace_message;
89
91 //yarp::os::Port port;
92
93 bool timeout(double base, double timeout);
94 yarp::os::Property& runProperty();
95 int requestServer(yarp::os::Property& config);
96 int SendMsg(yarp::os::Bottle& msg, std::string target,
97 yarp::os::Bottle& resp, float fTimeout=5.0);
98 bool getQosFromString(const std::string& qos, yarp::os::QosStyle& style);
99
100};
101
102} // namespace yarp::manager
103
104
105#endif // __YARP_MANAGER_YARPBROKER__
Class Broker.
Definition broker.h:30
bool rmconnect(const std::string &from, const std::string &to)
void threadRelease() override
Release method.
bool getAllPorts(std::vector< std::string > &stingList)
bool connected(const std::string &from, const std::string &to, const std::string &carrier) override
std::string requestRpc(const std::string &szport, const std::string &request, double timeout) override
void detachStdout() override
bool setQos(const std::string &from, const std::string &to, const std::string &qosFrom, const std::string &qosTo)
bool initialized() override
Definition yarpbroker.h:54
bool connect(const std::string &from, const std::string &to, const std::string &carrier, bool persist=false) override
connection broker
bool getAllProcesses(const std::string &server, ProcessContainer &processes)
bool threadInit() override
Initialization method.
std::string error() override
bool disconnect(const std::string &from, const std::string &to, const std::string &carrier) override
bool exists(const std::string &port) override
void run() override
Loop function.
bool attachStdout() override
bool getSystemInfo(const std::string &server, yarp::os::SystemInfoSerializer &info)
A simple collection of objects that can be described and transmitted in a portable way.
Definition Bottle.h:64
A mini-server for performing network communication in the background.
An abstraction for a periodic thread.
A class for storing options and configuration information.
Definition Property.h:33
Preferences for the port's Quality of Service.
Definition QosStyle.h:23
A class for thread synchronization and mutual exclusion.
Definition Semaphore.h:25
A helper class to pass the SystemInfo object around the YARP network.
std::vector< Process > ProcessContainer