Go to the documentation of this file.
28 #include "ros/xmlrpc_manager.h"
29 #include "ros/network.h"
30 #include "ros/param.h"
31 #include "ros/assert.h"
32 #include "ros/common.h"
33 #include "ros/file_log.h"
76 , name_(function_name)
82 func_(params, result);
114 XMLRPCManager::XMLRPCManager()
116 , shutting_down_(false)
117 , unbind_requested_(false)
138 std::stringstream ss;
161 for (V_CachedXmlRpcClient::iterator i =
clients_.begin();
178 for (
int wait_count = 0; !
clients_.empty() && wait_count < 10; wait_count++)
188 S_ASyncXMLRPCConnection::iterator it =
connections_.begin();
189 S_ASyncXMLRPCConnection::iterator end =
connections_.end();
190 for (; it != end; ++it)
212 if (
response.getType() != XmlRpcValue::TypeArray)
224 if (
response[0].getType() != XmlRpcValue::TypeInt)
226 ROSCPP_LOG_DEBUG(
"XML-RPC call [%s] didn't return a int as the 1st element",
231 if (
response[1].getType() != XmlRpcValue::TypeString)
233 ROSCPP_LOG_DEBUG(
"XML-RPC call [%s] didn't return a string as the 2nd element",
237 std::string status_string =
response[1];
238 if (status_code != 1)
241 method.c_str(), status_code, status_string.c_str());
250 std::string empty_array =
"<value><array><data></data></array></value>";
267 for (; it != end; ++it)
293 S_ASyncXMLRPCConnection::iterator it =
connections_.begin();
294 S_ASyncXMLRPCConnection::iterator end =
connections_.end();
295 for (; it != end; ++it)
308 for (; it != end; ++it)
326 for (V_CachedXmlRpcClient::iterator i =
clients_.begin();
332 if (i->client_->getHost() == host &&
333 i->client_->getPort() == port &&
334 i->client_->getUri() == uri)
378 for (V_CachedXmlRpcClient::iterator i =
clients_.begin();
420 info.
name = function_name;
const std::string response
std::shared_ptr< XMLRPCManager > XMLRPCManagerPtr
XmlRpc::XmlRpcValue responseStr(int code, const std::string &msg, const std::string &response)
XmlRpc::XmlRpcValue responseInt(int code, const std::string &msg, int response)
bool sleep() const
sleep for the amount of time specified by this Duration. If a signal interrupts the sleep,...
A class to handle XML RPC requests.
std::mutex added_connections_mutex_
std::mutex g_xmlrpc_manager_mutex
XmlRpc::XmlRpcValue responseBool(int code, const std::string &msg, bool response)
XMLRPCCallWrapperPtr wrapper
std::mutex clients_mutex_
std::shared_ptr< ASyncXMLRPCConnection > ASyncXMLRPCConnectionPtr
S_ASyncXMLRPCConnection added_connections_
A class to send XML RPC requests to a server and return the results.
ros::WallTime last_use_time_
void addASyncConnection(const ASyncXMLRPCConnectionPtr &conn)
M_StringToFuncInfo functions_
void removeASyncConnection(const ASyncXMLRPCConnectionPtr &conn)
bool validateXmlrpcResponse(const std::string &method, XmlRpc::XmlRpcValue &response, XmlRpc::XmlRpcValue &payload)
Validate an XML/RPC response.
V_CachedXmlRpcClient clients_
void getPid(const XmlRpcValue ¶ms, XmlRpcValue &result)
Abstract class representing a single RPC method.
void getPid(const XmlRpcValue ¶ms, XmlRpcValue &result)
std::thread server_thread_
S_ASyncXMLRPCConnection removed_connections_
std::mutex removed_connections_mutex_
Duration representation for use with the WallTime class.
XMLRPCManagerPtr g_xmlrpc_manager
bool bindAndListen(int port, int backlog=5)
XmlRpc::XmlRpcClient * getXMLRPCClient(const std::string &host, const int port, const std::string &uri)
void disableAllSignalsInThisThread()
void execute(XmlRpcValue ¶ms, XmlRpcValue &result)
const ROSCPP_DECL std::string & getHost()
Get the hostname where the master runs.
XmlRpc::XmlRpcServer server_
static const ros::WallDuration s_zombie_time_
XmlRpcDispatch * get_dispatch()
volatile bool unbind_requested_
S_ASyncXMLRPCConnection connections_
#define ROS_ASSERT(cond)
Asserts that the provided condition evaluates to true.
bool bind(const std::string &function_name, const XMLRPCFunc &cb)
void releaseXMLRPCClient(XmlRpc::XmlRpcClient *c)
void unbind(const std::string &function_name)
#define ROSCPP_LOG_DEBUG(...)
RPC method arguments and results are represented by Values.
std::mutex functions_mutex_
std::function< void(XmlRpc::XmlRpcValue &, XmlRpc::XmlRpcValue &)> XMLRPCFunc
XMLRPCCallWrapper(const std::string &function_name, const XMLRPCFunc &cb, XmlRpcServer *s)
sick_scan_xd
Author(s): Michael Lehning
, Jochen Sprickerhof , Martin Günther
autogenerated on Fri Oct 25 2024 02:47:13