|
YARP
Yet Another Robot Platform
|
|
Go to the documentation of this file.
28 yCDebug(SERVERSERIAL,
"std::string to send : %s", msg.
toString().c_str());
29 if(serial !=
nullptr) {
40 yCDebug(SERVERSERIAL,
"std::string to send : %s", msg);
41 if(serial !=
nullptr) {
42 serial->
send(msg, size);
51 if(serial !=
nullptr) {
61 if(serial !=
nullptr) {
70 if(serial !=
nullptr) {
71 return serial->
flush();
79 if (serial !=
nullptr) {
80 return serial->
setDTR(enable);
88 if(serial !=
nullptr) {
97 if (serial !=
nullptr) {
114 verb = (prop.
check(
"verbose",
Value(0),
"Specifies if the device is in verbose mode (0/1).").asInt32())>0;
116 yCInfo(SERVERSERIAL,
"running with verbose output");
119 if (prop.
check(
"subdevice",name,
"name of specific control device to wrap")) {
124 p.setMonitor(prop.getMonitor(),
131 poly.
open(subdevice);
137 yCError(SERVERSERIAL,
"\"--subdevice <name>\" not set for serial");
145 std::string rootName =
147 "prefix for port names").asString();
149 command_buffer.
attach(toDevice);
150 reply_buffer.
attach(fromDevice);
154 toDevice.
open(rootName+
"/in");
155 fromDevice.
open(rootName+
"/out");
162 if(serial !=
nullptr) {
167 yCError(SERVERSERIAL,
"subdevice <%s> doesn't look like a serial port (no appropriate interfaces were acquired)",
174 yCInfo(SERVERSERIAL,
"Server Serial starting");
182 reply_buffer.
write();
187 yCInfo(SERVERSERIAL,
"Server Serial stopping");
198 yCError(SERVERSERIAL,
"Could not get serial device");
210 yCError(SERVERSERIAL,
"Problems while trying to send data");
A simple collection of objects that can be described and transmitted in a portable way.
std::string toString() const override
Gives a human-readable textual representation of the bottle.
void put(const std::string &key, const std::string &value)
Associate the given key with the given string.
void clear()
Empties the bottle of any objects it contains.
A base class for nested structures that can be searched.
virtual bool receive(yarp::os::Bottle &msg)=0
Gets the existing chars in the receive queue.
virtual Bottle & findGroup(const std::string &key) const =0
Gets a list corresponding to a given keyword.
virtual std::string toString() const =0
Return a standard text representation of the content of the object.
void fromString(const std::string &txt, bool wipe=true)
Interprets a string as a list of properties.
bool isValid() const
Check if device is valid.
#define YARP_LOG_COMPONENT(name,...)
ImplementCallbackHelper2()
Constructor.
int receiveBytes(unsigned char *bytes, const int size) override
Gets an array of bytes (unsigned char) with size <= 'size' parameter.
bool send(const Bottle &msg) override
Sends a string of chars to the serial communications channel.
bool setDTR(bool enable) override
Enable/Disable DTR protocol.
bool view(T *&x)
Get an interface to the device driver.
bool open(const std::string &name) override
Start port operation, with a specific name, with automatically-chosen network parameters.
void attach(Port &port)
Attach this buffer to a particular port.
A generic interface to serial port devices.
virtual int receiveBytes(unsigned char *bytes, const int size)=0
Gets an array of bytes (unsigned char) with size <= 'size' parameter.
virtual bool setDTR(bool enable)=0
Enable/Disable DTR protocol.
bool open(const std::string &txt)
Construct and configure a device by its common name.
virtual int receiveChar(char &chr)=0
Gets one single char from the receive queue.
virtual bool isString() const
Checks if value is a string.
static void delaySystem(double seconds)
virtual bool check(const std::string &key) const =0
Check if there exists a property of the given name.
void useCallback(TypedReaderCallback< T > &callback) override
Set an object whose onRead method will be called when data is available.
serial: Export a serial sensor.
void onRead(Bottle &b) override
Callback function.
yarp::dev::ISerialDevice * ser
void attach(Port &port)
Set the Port to which objects will be written.
void run() override
The thread main loop deals with writing on ports here.
Bottle tail() const
Get all but the first element of a bottle.
#define yCError(component,...)
bool close() override
Close the device driver by deallocating all resources and closing ports.
bool isStopping()
Returns true if the thread is stopping (Thread::stop has been called).
#define yCInfo(component,...)
#define yCDebug(component,...)
int receiveLine(char *line, const int MaxLineLength) override
Gets one line (a sequence of chars with a ending '\n' or '\r') from the receive queue.
bool receive(Bottle &msg) override
Gets the existing chars in the receive queue.
virtual bool open()
Default open() method.
int flush() override
Flushes the internal buffer.
int receiveChar(char &c) override
Gets one single char from the receive queue.
T & get()
A synonym of PortWriterBuffer::prepare.
void write(bool forceStrict=false)
Try to write the last buffer returned by PortWriterBuffer::get.
virtual bool send(const yarp::os::Bottle &msg)=0
Sends a string of chars to the serial communications channel.
bool start()
Start the new thread running.
virtual int receiveLine(char *line, const int MaxLineLength)=0
Gets one line (a sequence of chars with a ending '\n' or '\r') from the receive queue.
std::string toString() const override
Return a standard text representation of the content of the object.
A single value (typically within a Bottle).
virtual int flush()=0
Flushes the internal buffer.
A class for storing options and configuration information.