rllib
1
|
#include <rlcommandlineinterface.h>
Public Member Functions | |
rlCommandlineInterface () | |
virtual | ~rlCommandlineInterface () |
int | start (const char *how, const char *command=NULL) |
int | start (rlSerial *tty) |
const char * | readLine (int timeout=0) |
int | readBlock (void *buf, int len, int timeout=0) |
int | printf (const char *format,...) |
int | writeBlock (void *buf, int len) |
Private Attributes | |
char | line [rl_PRINTF_LENGTH] |
rlSocket * | sock |
rlSpawn * | spawn |
rlSerial * | tty |
Commandline interface that allows applications to communicate over pipe || socket || serial line || stdio .
The parameters of start() are as follows: start("stdio"); // use stdin and stdout start("pipe","command"); // run "command" and connect it's stdio with us (runs on unix only) start("host:5050"); // connect to "host" on port 5050 and communicate with the server (tip: define a server with xinted on "host" port 5050) start("localhost:5050","command"); // run "command" and then try to connect to "localhost" port 5050 for communication with "command" start("server.localhost:5050"); // act as a server on "localhost" port 5050 (can serve only 1 client. if you want to serve more clients use rlSocket) start(tty); // use serial interface for communication
Return values: start() returns -1 on error readLine() returns the read string or NULL readBlock() returns the number of read bytes or -1 on error printf() returns the number of written characters or -1 on error writeBlock() returns the number of written bytes or -1 on error
Definition at line 42 of file rlcommandlineinterface.h.
rlCommandlineInterface::rlCommandlineInterface | ( | ) |
Definition at line 23 of file rlcommandlineinterface.cpp.
|
virtual |
Definition at line 30 of file rlcommandlineinterface.cpp.
int rlCommandlineInterface::printf | ( | const char * | format, |
... | |||
) |
Definition at line 180 of file rlcommandlineinterface.cpp.
int rlCommandlineInterface::readBlock | ( | void * | buf, |
int | len, | ||
int | timeout = 0 |
||
) |
Definition at line 107 of file rlcommandlineinterface.cpp.
const char * rlCommandlineInterface::readLine | ( | int | timeout = 0 | ) |
Definition at line 147 of file rlcommandlineinterface.cpp.
int rlCommandlineInterface::start | ( | const char * | how, |
const char * | command = NULL |
||
) |
Definition at line 36 of file rlcommandlineinterface.cpp.
int rlCommandlineInterface::start | ( | rlSerial * | tty | ) |
Definition at line 96 of file rlcommandlineinterface.cpp.
int rlCommandlineInterface::writeBlock | ( | void * | buf, |
int | len | ||
) |
Definition at line 210 of file rlcommandlineinterface.cpp.
|
private |
Definition at line 54 of file rlcommandlineinterface.h.
|
private |
Definition at line 55 of file rlcommandlineinterface.h.
|
private |
Definition at line 56 of file rlcommandlineinterface.h.
|
private |
Definition at line 57 of file rlcommandlineinterface.h.