|
![](gbx_logo_cardbox_sky_150x150.png)
INTRODUCTION
Overview
Download and Install
Documentation
Publications
REPOSITORY
Libraries
DEVELOPER
Dev Guide
Dashboard
PEOPLE
Contributors
Users
![SourceForge.net Logo](http://sourceforge.net/sflogo.php?group_id=216468&type=2)
Project
Download
Mailing lists
|
|
|
flexiport::SerialPort Class ReferenceSerial implementation of the Port class.
More...
#include <serialport.h>
Inherits flexiport::Port.
Inheritance diagram for flexiport::SerialPort:
[legend]List of all members.
|
Public Member Functions |
void | Open (void) |
| Open the port.
|
void | Close (void) |
| Close the port.
|
ssize_t | Read (void *const buffer, size_t count) |
| Read from the port.
|
ssize_t | ReadFull (void *const buffer, size_t count) |
| Read the requested quantity of data from the port.
|
ssize_t | BytesAvailable (void) |
| Get the number of bytes waiting to be read at the port. Returns immediatly.
|
ssize_t | BytesAvailableWait (void) |
| Get the number of bytes waiting after blocking for the timeout.
|
ssize_t | Write (const void *const buffer, size_t count) |
| Write data to the port.
|
void | Flush (void) |
| Flush the port's input and output buffers, discarding all data.
|
void | Drain (void) |
| Drain the port's input and output buffers.
|
std::string | GetStatus (void) const |
| Get the status of the port (type, device, etc).
|
void | SetTimeout (Timeout timeout) |
| Set the timeout value in milliseconds.
|
void | SetCanRead (bool canRead) |
| Set the read permissions of the port.
|
void | SetCanWrite (bool canWrite) |
| Set the write permissions of the port.
|
bool | IsOpen (void) const |
| Check if the port is open.
|
void | SetBaudRate (unsigned int baud) |
| Change the baud rate.
|
unsigned int | GetBaudRate (void) const |
| Get the current baud rate.
|
Detailed Description
Serial implementation of the Port class.
See the Port class documentation for how to use the common API.
- Note:
- Under Windows, the timeout resolution is milliseconds, not microseconds. The timeout value will be rounded to the nearest millisecond when used.
- Options
- device <string>
- Serial device to use.
- Default: /dev/ttyS0
- parity none|even|odd
- Data parity.
- Default: none
- baud <integer>
- Baud rate. Valid values are 50, 75, 110, 134, 150, 200, 300, 600, 1200, 1800, 2400, 4800, 9600, 19200, 34800, 57600, 115200, 230400.
- Default: 9600
- databits <integer>
- stopbits 1|2
- Number of stop bits: 1 or 2.
- Default: 1
- hwflowctrl
- Turn hardware flow control on.
- Default: off
Member Function Documentation
ssize_t flexiport::SerialPort::BytesAvailableWait |
( |
void |
|
) |
[virtual] |
Get the number of bytes waiting after blocking for the timeout.
- Note:
- Currently this function performs differently under Win32. It will block for the entire length of the timeout if data is not immediatly available. This will be fixed in the future.
Implements flexiport::Port.
The documentation for this class was generated from the following files:
|
|