73 if (
nullptr == m_iserial)
81 callback_impl = std::make_unique<SerialPort_CallbackHelper>(m_iserial);
89bool SerialPort_nws_yarp::detach()
95bool SerialPort_nws_yarp::receive(
Bottle&
msg)
97 if (m_iserial !=
nullptr)
108int SerialPort_nws_yarp::receiveChar(
char&
c)
110 if (m_iserial !=
nullptr)
120bool SerialPort_nws_yarp::closeMain()
135 bool b = m_rpc.
read(connection);
151 std::lock_guard <std::mutex>
lg(m_mutex);
154 return m_iser->
setDTR(enable);
162 std::lock_guard <std::mutex>
lg(m_mutex);
165 return m_iser->
flush();
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
void setInterfaces(yarp::dev::ISerialDevice *iser)
bool setDTR(bool enable) override
void onRead(Bottle &b) override
yarp::dev::ISerialDevice * m_iser
SerialPort_CallbackHelper()
bool parseParams(const yarp::os::Searchable &config) override
Parse the DeviceDriver parameters.
virtual ~SerialPort_nws_yarp() override
void run() override
Main body of the new thread.
bool close() override
Close the DeviceDriver.
bool open(yarp::os::Searchable &config) override
Open the DeviceDriver.
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
A generic interface to serial port devices.
virtual bool setDTR(bool enable)=0
Enable/Disable DTR protocol.
virtual int flush()=0
Flushes the internal buffer.
virtual bool send(const yarp::os::Bottle &msg)=0
Sends a string of chars to the serial communications channel.
virtual int receiveChar(char &chr)=0
Gets one single char from the receive queue.
virtual bool receive(yarp::os::Bottle &msg)=0
Gets the existing chars in the receive queue.
A container for a device driver.
A simple collection of objects that can be described and transmitted in a portable way.
void clear()
Empties the bottle of any objects it contains.
A mini-server for performing network communication in the background.
void close() override
Stop port activity.
void disableCallback() override
Remove a callback set up with useCallback()
bool open(const std::string &name) override
Start port operation, with a specific name, with automatically-chosen network parameters.
void useCallback(TypedReaderCallback< T > &callback) override
Set an object whose onRead method will be called when data is available.
void write(bool forceStrict=false)
Write the current object being returned by BufferedPort::prepare.
T & prepare()
Access the object which will be transmitted by the next call to yarp::os::BufferedPort::write.
An interface for reading from a network connection.
void setReader(PortReader &reader) override
Set an external reader for port data.
void close() override
Stop port activity.
bool open(const std::string &name) override
Start port operation, with a specific name, with automatically-chosen network parameters.
A base class for nested structures that can be searched.
static void delaySystem(double seconds)
bool stop()
Stop the thread.
bool isStopping()
Returns true if the thread is stopping (Thread::stop has been called).
bool isRunning()
Returns true if the thread is running (Thread::start has been called successfully and the thread has ...
bool start()
Start the new thread running.
#define yCInfo(component,...)
#define yCError(component,...)
#define YARP_LOG_COMPONENT(name,...)