Access RS232 port on Unix/Linux.
More...
#include <Map27/UnixPort.h>
|
uint32_t | _baud |
| The currently configured baud rate.
|
|
Access RS232 port on Unix/Linux.
This is a concrete implementation of Map27Port for use on Unix/Linux platforms. It is automatically selected by Port.cpp at compile time, so you should only need to link with Port.o.
You should specify the underlying device to use with setDevice(), which defaults to '/dev/ttyUSB0'.
- Examples:
- test2.cpp, and test3.cpp.
Map27UnixPort::Map27UnixPort |
( |
| ) |
|
Constructor The default device is '/dev/ttyUSB0'.
bool Map27UnixPort::canRead |
( |
| ) |
|
|
virtual |
Test whether readable input characters are waiting
- Returns
- true if one or more octets are waiting to be read from the underlying device
Reimplemented from Map27Port.
bool Map27UnixPort::close |
( |
| ) |
|
|
virtual |
Close the underlying physical device if it is currently open
Reimplemented from Map27Port.
const char * Map27UnixPort::device |
( |
| ) |
|
Get the currently configured device
- Returns
- The currently configured RS232 device name
bool Map27UnixPort::open |
( |
| ) |
|
|
virtual |
Open the underlying physical device Sets the baud rate to the configured rate and to 8N1
Reimplemented from Map27Port.
uint8_t Map27UnixPort::read |
( |
| ) |
|
|
virtual |
Reads a single octet from the underlying device
- Returns
- The next octet to be read. Undefined if canRead() is not true.
Reimplemented from Map27Port.
void Map27UnixPort::send |
( |
uint8_t |
ch | ) |
|
|
virtual |
Sends a single octet to the underlying physical device
- Parameters
-
[in] | ch | The character to send. Blocks until the character is queued by the operating system |
[in] | ch | The octet to send |
Reimplemented from Map27Port.
void Map27UnixPort::setDevice |
( |
const char * |
device | ) |
|
Sets the name of the underlying RS232 device to open. Defaults to '/dev/ttyUSB0'.
- Parameters
-
[in] | device | ASCII name of the UNix device of the RS232 port to open |
- Examples:
- test2.cpp, and test3.cpp.
The documentation for this class was generated from the following files: