|
YARP
Yet Another Robot Platform
|
|
Go to the documentation of this file.
27 using YarpXmlRpc::XmlRpcValue;
28 using YarpXmlRpc::XmlRpcClient;
29 using YarpXmlRpc::XmlRpcServerConnection;
40 vout = std::string(
"[") + std::string(vin.
toString()) +
"]";
49 }
else if (tag==
"dict") {
54 for (
size_t i=0; i<bot->
size(); i++) {
68 for (
size_t i=offset; i<bot->
size(); i++) {
70 XmlRpcValue& vouti=vout[std::string(boti->
get(0).
toString())]=XmlRpcValue();
75 for (
size_t i=offset; i<bot->
size(); i++) {
76 XmlRpcValue& vouti = vout[i] = XmlRpcValue();
103 if (header.length()>0 && header[0]==
'q') {
110 std::string methodName;
116 if (bot->
size()==1) {
125 c.generateRequest(methodName.c_str(),args);
126 req = c.getRequest();
128 XmlRpcServerConnection c(0,
nullptr);
129 c.generateResponse(args.toXml());
130 req = c.getResponse();
134 if (req.length()<8) {
146 Bytes b((
char*)http.c_str(),http.length());
151 Bytes b((
char*)req.c_str()+start,req.length()-start);
160 return write(proto,writer);
173 bool nodelike =
false;
183 if (opt.
check(
"node_like")) {
188 std::string rospass = n.getCarrierModifier(
"ros");
189 interpretRos = !nodelike;
190 if (rospass==
"1"||rospass==
"on") {
193 if (rospass==
"0"||rospass==
"off") {
194 interpretRos =
false;
201 shouldInterpretRosMessages(proto);
202 std::string target =
"POST /RPC2";
211 target +=
" HTTP/1.1\n";
213 Bytes b((
char*)target.c_str(),target.length());
221 shouldInterpretRosMessages(proto);
226 if (stream ==
nullptr) {
bool respondToHeader(yarp::os::ConnectionState &proto) override
Respond to the header.
A simple collection of objects that can be described and transmitted in a portable way.
const std::string & getCarrierName() const
Get the carrier type of the route.
size_type size() const
Gets the number of elements in the bottle.
virtual TwoWayStream * giveStreams()=0
Take ownership of the streams associated with the connection.
virtual void write(char ch)
Write a single byte to the stream.
bool expectSenderSpecifier(yarp::os::ConnectionState &proto) override
Expect the name of the sending port.
std::string toString() const
void fromString(const std::string &text)
Initializes bottle from a string.
virtual void write(OutputStream &os)
Information about a connection between two ports.
An OutputStream that produces a string.
virtual bool isString() const
Checks if value is a string.
static Contact queryName(const std::string &name)
Find out information about a registered name.
virtual void takeStreams(TwoWayStream *streams)=0
Provide streams to be used with the connection.
OutputStream & os()
Shorthand for getOutputStream()
virtual const Route & getRoute() const =0
Get the route associated with this connection.
Value & get(size_type index) const
Reads a Value v from a certain part of the list.
virtual bool isFloat64() const
Checks if value is a 64-bit floating point number.
const yarp::os::LogComponent & XMLRPCCARRIER()
virtual void setRoute(const Route &route)=0
Set the route associated with this connection.
virtual std::string asString() const
Get string value.
std::string getCarrierModifier(const char *mod, bool *hasModifier=nullptr)
virtual const Contact & getRemoteAddress() const =0
Get the address of the remote side of the stream.
Simple abstraction for a YARP port name.
bool check(const std::string &key) const override
Check if there exists a property of the given name.
virtual TwoWayStream & getStreams()=0
Access the streams associated with the connection.
A simple abstraction for a block of bytes.
virtual bool isList() const
Checks if value is a list.
Bottle tail() const
Get all but the first element of a bottle.
The basic state of a connection - route, streams in use, etc.
#define yCError(component,...)
virtual bool isOk() const =0
Check if the stream is ok or in an error state.
virtual std::int32_t asInt32() const
Get 32-bit integer value.
bool write(yarp::os::ConnectionState &proto, yarp::os::SizedWriter &writer) override
Write a message.
An interface to the operating system, including Port based communication.
void setFromName(const std::string &fromName)
Set the source of the route.
const std::string & getToName() const
Get the destination of the route.
virtual Bottle * asList() const
Get list value.
bool reply(yarp::os::ConnectionState &proto, yarp::os::SizedWriter &writer) override
virtual Contactable * getContactable() const =0
Get the port associated with the connection.
std::string toString() const override
Return a standard text representation of the content of the object.
bool write(const ImageOf< PixelRgb > &src, const std::string &dest, image_fileformat format=FORMAT_PPM)
A single value (typically within a Bottle).
bool sendHeader(yarp::os::ConnectionState &proto) override
Write a header appropriate to the carrier to the connection, followed by any carrier-specific data.
virtual yarp::conf::float64_t asFloat64() const
Get 64-bit floating point value.
Minimal requirements for an efficient Writer.
virtual bool isVocab() const
Checks if value is a vocabulary identifier.
A class for storing options and configuration information.
void toXmlRpcValue(Value &vin, XmlRpcValue &vout)
virtual bool isInt32() const
Checks if value is a 32-bit integer.