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#include <yarp/os/SystemInfo.h>
21
22#include <yarp/manager/broker.h>
24
25namespace yarp::manager {
26
27
32
33public:
34 YarpBroker();
35 ~YarpBroker() override;
36 bool init() override;
37 bool init(const char* szcmd, const char* szparam,
38 const char* szhost, const char* szstdio,
39 const char* szworkdir, const char* szenv ) override;
40 void fini() override;
41 bool start() override;
42 bool stop() override;
43 bool kill() override;
44 bool connect(const std::string& from, const std::string& to, const std::string& carrier, bool persist = false) override;
45 bool disconnect(const std::string& from, const std::string& to, const std::string& carrier) override;
46 bool rmconnect(const std::string& from, const std::string& to);
47 int running() override;
48 bool exists(const std::string& port) override;
49 std::string requestRpc(const std::string& szport, const std::string& request, double timeout) override;
50 bool connected(const std::string& from, const std::string& to, const std::string& carrier) override;
51 std::string error() override;
52 bool initialized() override { return bInitialized;}
53 bool attachStdout() override;
54 void detachStdout() override;
55
56 bool getSystemInfo(const std::string& server,
58 bool getAllProcesses(const std::string& server,
59 ProcessContainer &processes);
60 bool getAllPorts(std::vector<std::string> &stingList);
61
62 bool setQos(const std::string& from, const std::string& to, const std::string& qosFrom, const std::string& qosTo);
63
64public: // for rate thread
65 void run() override;
66 bool threadInit() override;
67 void threadRelease() override;
68
69protected:
70
71private:
72 std::string strCmd;
73 std::string strParam;
74 std::string strHost;
75 std::string strStdio;
76 std::string strWorkdir;
77 std::string strTag;
78 std::string strEnv;
79 unsigned int ID;
80 yarp::os::Property command;
81 std::string strError;
82 bool bOnlyConnector;
83 bool bInitialized;
84 yarp::os::Semaphore semParam;
85 std::string strStdioUUID;
86 std::string __trace_message;
87
89 //yarp::os::Port port;
90
91 bool timeout(double base, double timeout);
92 yarp::os::Property& runProperty();
93 int requestServer(yarp::os::Property& config);
94 int SendMsg(yarp::os::Bottle& msg, std::string target,
95 yarp::os::Bottle& resp, float fTimeout=5.0);
96 bool getQosFromString(const std::string& qos, yarp::os::QosStyle& style);
97
98};
99
100} // namespace yarp::manager
101
102
103#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:52
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::SystemInfo &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:32
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 class to get the system (platform) status such as available memory, storage, CPU load and etc.
Definition SystemInfo.h:25
std::vector< Process > ProcessContainer