7 #include <wvistreamlist.h>
12 void concallback(
WvStream &con,
void *userdata)
18 modem.print(
"%s\r", str);
23 const char *argv1[] = {
"sh",
"-c",
24 "while :; do echo foo; sleep 3; done", NULL };
25 const char *argv2[] = {
"sh",
"-c",
26 "while :; do echo snorkle; sleep 2; done", NULL };
28 WvLog log(
"logger", WvLog::Info);
29 WvLog modemlog(
"modem", WvLog::Info);
30 WvPipe pipe1(argv1[0], argv1,
false,
true,
false);
31 WvPipe pipe2(argv2[0], argv2,
false,
true,
false);
32 WvModem modem(
"/dev/ttyS2", O_RDWR);
34 pipe1.autoforward(log);
35 pipe2.autoforward(log);
40 l.append(&pipe1,
false);
41 l.append(&pipe2,
false);
42 l.append(&modem,
false);
43 l.append(wvcon,
false);
46 modemlog(WvLog::Error,
"%s\n", modem.errstr());
Implementation of a WvPipe stream.
bool select(time_t msec_timeout)
Return true if any of the requested features are true on the stream.
virtual void callback()
if the stream has a callback function defined, call it now.
A WvLog stream accepts log messages from applications and forwards them to all registered WvLogRcv's.
WvModem implements a named modem that really needs to be opened, closed, and manipulated in lots of w...
char * getline(time_t wait_msec=0, char separator='\n', int readahead=1024)
Read up to one line of data from the stream and return a pointer to the internal buffer containing th...
void autoforward(WvStream &s)
set the callback function for this stream to an internal routine that auto-forwards all incoming stre...
virtual bool isok() const
return true if the stream is actually usable right now
Unified support for streams, that is, sequences of bytes that may or may not be ready for read/write ...
void setcallback(IWvStreamCallback _callfunc)
define the callback function for this stream, called whenever the callback() member is run,...
WvStreamList holds a list of WvStream objects – and its select() and callback() functions know how to...