27#ifndef ASYNC_PTY_INCLUDED
28#define ASYNC_PTY_INCLUDED
38#include <sigc++/sigc++.h>
124class Pty :
public sigc::trackable
131 Pty(
const std::string& slave_link=
"");
144 m_is_line_buffered = line_buffered;
145 m_line_buffer.clear();
186 ssize_t
write(
const void *buf,
size_t count);
199 ssize_t
write(
const std::string& str)
201 return write(str.c_str(), str.size());
208 bool isOpen(
void)
const {
return m_master >= 0; }
214 const std::string&
slavePath(
void)
const {
return m_slave_path; }
226 static const int POLLHUP_CHECK_INTERVAL = 100;
228 std::string m_slave_link;
232 bool m_is_line_buffered =
false;
233 std::string m_line_buffer;
234 std::string m_slave_path;
237 Pty& operator=(
const Pty&);
239 void charactersReceived(
void);
240 short pollMaster(
void);
241 void checkIfSlaveEndOpen(
void);
Contains a watch for file descriptors.
Contains a single shot or periodic timer that emits a signal on timeout.
A class for watching file descriptors.
A wrapper class for using a PTY.
void setLineBuffered(bool line_buffered)
Turn line buffering on or off.
bool isOpen(void) const
Check if the PTY is open or not.
const std::string & slavePath(void) const
Get the path to the slave PTS device.
ssize_t write(const std::string &str)
Write a string to the PTY.
void close(void)
Close the PTY if it's open.
bool open(void)
Open the PTY.
ssize_t write(const void *buf, size_t count)
Write data to the PTY.
bool reopen(void)
Reopen the PTY.
Pty(const std::string &slave_link="")
Constructor.
sigc::signal< void, const void *, size_t > dataReceived
Signal that is emitted when data has been received.
A class that produces timer events.
Namespace for the asynchronous programming classes.