29 m_remote_name.clear();
34 if (m_local_name ==
"")
36 yCError(ROBOTDESCRIPTIONCLIENT,
"open(): Invalid local name");
40 if (m_remote_name ==
"")
42 yCError(ROBOTDESCRIPTIONCLIENT,
"open(): Invalid remote name");
46 std::string local_rpc, remote_rpc;
48 local_rpc = m_local_name +
"/rpc";
49 remote_rpc = m_remote_name +
"/rpc";
51 if (!m_rpc_port.open(local_rpc))
53 yCError(ROBOTDESCRIPTIONCLIENT,
"open(): Could not open rpc port %s, check network", local_rpc.c_str());
60 ok = Network::connect(local_rpc, remote_rpc);
63 yCError(ROBOTDESCRIPTIONCLIENT,
"open(): Could not connect to %s", remote_rpc.c_str());
88 bool ret = m_rpc_port.write(b, resp);
93 yCError(ROBOTDESCRIPTIONCLIENT) <<
"getAllDevices(): Received error from server";
99 for (
size_t i = 0; i < b->
size(); i += 2)
104 dev_list.push_back(desc);
111 yCError(ROBOTDESCRIPTIONCLIENT) <<
"Error on writing on rpc port";
126 bool ret = m_rpc_port.write(b, resp);
131 yCError(ROBOTDESCRIPTIONCLIENT) <<
"unregisterDevice(): Received error from server";
137 yCError(ROBOTDESCRIPTIONCLIENT) <<
"Error on writing on rpc port";
153 bool ret = m_rpc_port.write(b, resp);
158 yCError(ROBOTDESCRIPTIONCLIENT) <<
"registerDevice(): Received error from server";
164 yCError(ROBOTDESCRIPTIONCLIENT) <<
"Error on writing on rpc port";
179 bool ret = m_rpc_port.write(b, resp);
184 yCError(ROBOTDESCRIPTIONCLIENT) <<
"getAllDevices(): Received error from server";
190 for (
size_t i = 0; i < b->
size();i+=2)
195 dev_list.push_back(desc);
202 yCError(ROBOTDESCRIPTIONCLIENT) <<
"Error on writing on rpc port";
constexpr yarp::conf::vocab32_t VOCAB_OK
constexpr yarp::conf::vocab32_t VOCAB_IROBOT_SET
constexpr yarp::conf::vocab32_t VOCAB_IROBOT_DEVICE
constexpr yarp::conf::vocab32_t VOCAB_IROBOT_DELETE
constexpr yarp::conf::vocab32_t VOCAB_IROBOT_DESCRIPTION
constexpr yarp::conf::vocab32_t VOCAB_IROBOT_BY_TYPE
constexpr yarp::conf::vocab32_t VOCAB_IROBOT_ALL
constexpr yarp::conf::vocab32_t VOCAB_IROBOT_GET
bool open(yarp::os::Searchable &config) override
Open the DeviceDriver.
bool getAllDevices(std::vector< yarp::dev::DeviceDescription > &dev_list) override
Ask the complete list of all yarp device drivers registered by a robot description server.
bool registerDevice(const yarp::dev::DeviceDescription &dev) override
Register a new running yarp device into a robot description server.
bool unregisterDevice(const std::string &device_name) override
Unregister a running yarp device from a robot description server.
bool close() override
Close the DeviceDriver.
bool getAllDevicesByType(const std::string &type, std::vector< yarp::dev::DeviceDescription > &dev_list) override
Ask a list of all registered yarp device drivers whose type corresponds to the given param.
A simple collection of objects that can be described and transmitted in a portable way.
void addVocab32(yarp::conf::vocab32_t x)
Places a vocabulary item in the bottle, at the end of the list.
size_type size() const
Gets the number of elements in the bottle.
Value & get(size_type index) const
Reads a Value v from a certain part of the list.
void clear()
Empties the bottle of any objects it contains.
void addString(const char *str)
Places a string in the bottle, at the end of the list.
A base class for nested structures that can be searched.
virtual Value & find(const std::string &key) const =0
Gets a value corresponding to a given keyword.
virtual yarp::conf::vocab32_t asVocab32() const
Get vocabulary identifier as an integer.
virtual Bottle * asList() const
Get list value.
virtual std::string asString() const
Get string value.
#define yCError(component,...)
#define YARP_LOG_COMPONENT(name,...)
An interface for the device drivers.
An interface to the operating system, including Port based communication.