icub-client
subSystem_iol2opc.cpp
Go to the documentation of this file.
1 #include <yarp/os/all.h>
3 
5  if(yarp::os::Network::isConnected(portRPC.getName(), "/iol2opc/rpc")) {
6  return true;
7  } else {
8  return yarp::os::Network::connect(portRPC.getName(), "/iol2opc/rpc");
9  }
10 }
11 
12 icubclient::SubSystem_IOL2OPC::SubSystem_IOL2OPC(const std::string &masterName) : SubSystem(masterName) {
13  portRPC.open(("/" + m_masterName + "/iol2opc:rpc").c_str());
15 }
16 
18  portRPC.interrupt();
19  portRPC.close();
20 }
21 
22 bool icubclient::SubSystem_IOL2OPC::changeName(const std::string &old_name, const std::string &new_name) {
23  yarp::os::Bottle bReq, bResp;
24  bReq.addString("change_name");
25  bReq.addString(old_name);
26  bReq.addString(new_name);
27  portRPC.write(bReq, bResp);
28 
29  return bResp.get(0).asBool();
30 }
31 
33  yarp::os::Bottle bReq, bResp;
34  bReq.addString("pause");
35  portRPC.write(bReq, bResp);
36 }
37 
39  yarp::os::Bottle bReq, bResp;
40  bReq.addString("resume");
41  portRPC.write(bReq, bResp);
42 }
std::string m_type
Definition: subSystem.h:47
yarp::os::RpcClient portRPC
Definition: subSystem.h:48
SubSystem_IOL2OPC(const std::string &masterName)
Default constructor.
bool changeName(const std::string &old_name, const std::string &new_name)
Change the name of an object Internally used by ICubClient::changeName.
Abstract class to handle sub-systems of the icub-client.
Definition: subSystem.h:43
void pause()
Pause the iol2opc object detection.
virtual void Close()
Clean up resources.
void resume()
Resume the iol2opc object detection.
#define SUBSYSTEM_IOL2OPC
std::string m_masterName
Definition: subSystem.h:46