|
YARP
Yet Another Robot Platform
|
|
Go to the documentation of this file.
37 group = getPeers().add(portName,
this);
45 options.
put(
"source", sourceName);
46 options.
put(
"destination", portName);
47 options.
put(
"sender_side",
49 options.
put(
"receiver_side",
52 return configureFromProperty(options);
62 std::string script = options.
check(
"type",
Value(
"lua")).asString();
63 std::string filename = options.
check(
"file",
Value(
"modifier")).asString();
64 std::string constraint = options.
check(
"constraint",
Value(
"")).asString();
66 std::string context = options.
check(
"context",
Value(
"")).asString();
76 binder->setAcceptConstraint(constraint.c_str());
78 std::string strFile = filename;
87 strFile = rf.
findFile(filename+
".lua");
95 info.
put(
"filename", strFile);
96 info.
put(
"type", script);
100 info.
put(
"receiver_side",options.
find(
"receiver_side").
asInt32());
104 bReady = binder->load(info);
117 binder->setParams(params);
129 binder->getParams(params);
146 if(!binder->hasUpdate()) {
157 if(result.
write(con.getWriter())) {
158 auto& cReader = con.getReader(reader.
getWriter());
159 cReader.setParentConnectionReader(&reader);
161 cReader.getWriter()->setReplyHandler(*result.
getPortReader());
177 localReader = &reader;
179 if(binder->hasAccept())
185 result = binder->acceptData(thing);
199 if(thing.
write(con.getWriter())) {
200 localReader = &con.getReader(reader.
getWriter());
207 result = group->acceptIncomingData(
this);
223 if(!binder->hasUpdate()) {
244 if(!binder->hasAccept()) {
251 bool result = binder->acceptData(thing);
265 if(!binder->hasUpdateReply()) {
271 thing.setPortReader(&reader);
289 if (peers==
nullptr) {
305 for (
auto& it : peerSet)
yarp::os::PortWriter * getPortWriter()
void put(const std::string &key, const std::string &value)
Associate the given key with the given string.
const std::string & getCarrierName() const
Get the carrier type of the route.
virtual void setParentConnectionReader(ConnectionReader *parentConnectionReader)
Set ConnectionReader to be used for reading the envelope.
virtual bool canAccept()=0
virtual bool peerTrigged()=0
static void lock()
Call wait() on a global mutual-exclusion semaphore allocated by YARP.
void fromString(const std::string &txt, bool wipe=true)
Interprets a string as a list of properties.
yarp::os::PortReader & modifyReply(yarp::os::PortReader &reader) override
Modify reply payload data, if appropriate.
bool setConnectionReader(yarp::os::ConnectionReader &reader)
set a reference to a ConnectionReader
Allow to monitor and modify port data from Lua script Under development.
bool acceptIncomingData(yarp::os::ConnectionReader &reader) override
Determine whether incoming data should be accepted.
Base class for generic things.
Value & find(const std::string &key) const override
Gets a value corresponding to a given keyword.
bool write(yarp::os::ConnectionWriter &connection)
Interface implemented by all objects that can write themselves to the network, such as Bottle objects...
MonitorBinding * getBinder()
std::string findFile(const std::string &name)
Find the full path to a file.
void setPortWriter(yarp::os::PortWriter *writer)
Set the reference to a PortWriter object.
virtual const Route & getRoute() const =0
Get the route associated with this connection.
bool setDefaultContext(const std::string &contextName)
Sets the context for the current ResourceFinder object.
bool configure(int argc, char *argv[], bool skipFirstArgument=true)
Sets up the ResourceFinder.
Interface implemented by all objects that can read themselves from the network, such as Bottle object...
bool acceptOutgoingData(const yarp::os::PortWriter &writer) override
Determine whether outgoing data should be accepted.
bool configure(yarp::os::ConnectionState &proto) override
Class PortMonitor.
virtual std::string asString() const
Get string value.
void getCarrierParams(yarp::os::Property ¶ms) const override
Get carrier configuration and deliver it by port administrative commands.
bool check(const std::string &key) const override
Check if there exists a property of the given name.
virtual ConnectionWriter * getWriter()=0
Gets a way to reply to the message, if possible.
yarp::os::ConnectionReader & modifyIncomingData(yarp::os::ConnectionReader &reader) override
Modify incoming payload data, if appropriate.
void clear()
Remove all associations.
#define yCAssert(component, x)
An interface for reading from a network connection.
The basic state of a connection - route, streams in use, etc.
#define yCError(component,...)
virtual std::string getSenderSpecifier() const =0
Extract a name for the sender, if the connection type supports that.
virtual std::int32_t asInt32() const
Get 32-bit integer value.
static MonitorBinding * create(const char *script_type)
factory method
An interface to the operating system, including Port based communication.
virtual bool acceptIncomingData(PortMonitor *source)
static void unlock()
Call post() on a global mutual-exclusion semaphore allocated by YARP.
const yarp::os::LogComponent & PORTMONITORCARRIER()
const std::string & getToName() const
Get the destination of the route.
void setCarrierParams(const yarp::os::Property ¶ms) override
Configure carrier from port administrative commands.
#define yCTrace(component,...)
virtual Contactable * getContactable() const =0
Get the port associated with the connection.
A single value (typically within a Bottle).
const std::string & getFromName() const
Get the source of the route.
bool configureFromProperty(yarp::os::Property &options) override
const yarp::os::PortWriter & modifyOutgoingData(const yarp::os::PortWriter &writer) override
Modify outgoing payload data, if appropriate.
yarp::os::PortReader * getPortReader()
A class for storing options and configuration information.
Helper class for finding config files and other external resources.