Tekkotsu Homepage | Demos | Overview | Downloads | Dev. Resources | Reference | Credits |
ExecutableCommPort Class ReferenceRun a specified executable, with the comm port connected to its stdin and stdout. More...
Inheritance diagram for ExecutableCommPort:
Detailed DescriptionRun a specified executable, with the comm port connected to its stdin and stdout. This can be handy for testing with a device simulator, or if you want to interface with a device as an external process. It's more efficient to run your driver as an DeviceDriver subclass than to spawn an external process however. If you need to keep your external program running across instances of the simulator (or just want to launch it externally), you'll need to use file system fifos (see mkfifo command), probably separate ones for reading and writing with a RedirectionCommPort to combine them (unless your platform supports bidirectional pipes... most don't) Definition at line 18 of file ExecutableCommPort.h.
Member Enumeration Documentation
Definition at line 59 of file ExecutableCommPort.h. Constructor & Destructor Documentation
Definition at line 20 of file ExecutableCommPort.h.
destructor, checks that child process is no longer running, kills it if it is (after some delay) Definition at line 11 of file ExecutableCommPort.cc. Member Function Documentation
sends kill signal to the child process Implements CommPort. Definition at line 100 of file ExecutableCommPort.cc. Referenced by open(), and plistValueChanged().
Returns the name of the class (aka its type). Suggested implementation is to declare a static string member, set it to the result of calling the registry's registerType, and then return that member here Implements CommPort. Definition at line 32 of file ExecutableCommPort.h. Referenced by plistValueChanged().
Returns a std::basic_streambuf, which is expected to implement the actual work. You can pass this to an istream to use the nice C++ style input and output, or you can call the streambuf functions directly. However, if you're going the latter route, probably easier to just call CommPort's own read() and write(). Depending on implementation, the streambuf this returns might be a different instance than getWriteStreambuf. If they are the same instance, then you could use an iostream instead of separate istream and ostream. Implements CommPort. Definition at line 34 of file ExecutableCommPort.h.
Returns a std::basic_streambuf, which is expected to implement the actual work. You can pass this to an ostream to use the nice C++ style input and output, or you can call the streambuf functions directly. However, if you're going the latter route, probably easier to just call CommPort's own read() and write(). Depending on implementation, the streambuf this returns might be a different instance than getReadStreambuf. If they are the same instance, then you could use an iostream instead of separate istream and ostream. Implements CommPort. Definition at line 35 of file ExecutableCommPort.h.
returns true if child is still running Definition at line 138 of file ExecutableCommPort.cc. Referenced by waitChild(), and ~ExecutableCommPort().
Allows you to check whether the reference from getReadStreambuf() is currently functional (if checking is supported!). For streambufs which don't have a way to check this, always returns true. Reimplemented from CommPort. Definition at line 37 of file ExecutableCommPort.h.
Allows you to check whether the reference from getWriteStreambuf() is currently functional (if checking is supported!). For streambufs which don't have a way to check this, always returns true. Reimplemented from CommPort. Definition at line 36 of file ExecutableCommPort.h.
launches the executable, connecting its stdin and stdout to this comm port Implements CommPort. Definition at line 36 of file ExecutableCommPort.cc. Referenced by plistValueChanged().
if command is modified, close current connection (if running) and launch new one Implements PrimitiveListener. Definition at line 113 of file ExecutableCommPort.cc.
waits for child process to exit for t milliseconds, polling status every p millseconds, returns true if no longer running Definition at line 127 of file ExecutableCommPort.cc. Referenced by ~ExecutableCommPort(). Member Data Documentation
holds the class name, set via registration with the CommPort registry Definition at line 71 of file ExecutableCommPort.h. Referenced by getClassName().
process ID of the child (0 if not launched, -1 if error) Definition at line 52 of file ExecutableCommPort.h. Referenced by isChildRunning(), open(), and ~ExecutableCommPort().
shell command Definition at line 48 of file ExecutableCommPort.h. Referenced by close(), ExecutableCommPort(), open(), plistValueChanged(), and ~ExecutableCommPort().
reference count of the number of times we've been opened (i.e. pending close()s) Definition at line 57 of file ExecutableCommPort.h. Referenced by close(), open(), plistValueChanged(), and ~ExecutableCommPort().
reads from child process Definition at line 54 of file ExecutableCommPort.h. Referenced by close(), getReadStreambuf(), isReadable(), and open().
shell name Definition at line 49 of file ExecutableCommPort.h. Referenced by close(), ExecutableCommPort(), open(), plistValueChanged(), and ~ExecutableCommPort().
writes to child process Definition at line 55 of file ExecutableCommPort.h. Referenced by close(), getWriteStreambuf(), isWriteable(), and open(). The documentation for this class was generated from the following files: |
Tekkotsu Hardware Abstraction Layer 5.1CVS |
Generated Mon May 9 05:01:41 2016 by Doxygen 1.6.3 |