icub-client
subSystem_agentDetector.cpp
Go to the documentation of this file.
1 #include <yarp/os/all.h>
3 
5  if(yarp::os::Network::isConnected(portRPC.getName(), "/agentDetector/rpc")) {
6  return true;
7  } else {
8  return yarp::os::Network::connect(portRPC.getName(), "/agentDetector/rpc");
9  }
10 }
11 
12 icubclient::SubSystem_agentDetector::SubSystem_agentDetector(const std::string &masterName) : SubSystem(masterName) {
13  portRPC.open(("/" + m_masterName + "/agentDetector:rpc").c_str());
15 }
16 
18  portRPC.interrupt();
19  portRPC.close();
20 }
21 
22 bool icubclient::SubSystem_agentDetector::changeDefaultName(const std::string &new_name) { // need to be extended for several agents
23  yarp::os::Bottle bReq, bResp;
24  bReq.addString("change_partner_name");
25  bReq.addString(new_name);
26  portRPC.write(bReq, bResp);
27 
28  if(bResp.get(0).asString()=="ack")
29  return true;
30  else
31  return false;
32 }
33 
35  yarp::os::Bottle bReq, bResp;
36  bReq.addString("pause");
37  portRPC.write(bReq, bResp);
38 }
39 
41  yarp::os::Bottle bReq, bResp;
42  bReq.addString("resume");
43  portRPC.write(bReq, bResp);
44 }
bool changeDefaultName(const std::string &new_name)
Changes the name of the partner within agentDetector Internally used by ICubClient::changeName.
std::string m_type
Definition: subSystem.h:47
yarp::os::RpcClient portRPC
Definition: subSystem.h:48
void resume()
The skeleton detection of agentDetector will be resumed.
#define SUBSYSTEM_AGENTDETECTOR
Abstract class to handle sub-systems of the icub-client.
Definition: subSystem.h:43
void pause()
Pause the agentDetector.
SubSystem_agentDetector(const std::string &masterName)
Default constructor.
virtual void Close()
Clean up resources.
std::string m_masterName
Definition: subSystem.h:46