![]() |
RflySimSDK v3.05
RflySimSDK说明文档
|
A simple class wrapping the functionality of vrpn_Serial.h with RAII, object-orientation, and optional STL types 更多...
#include <vrpn_SerialPort.h>
类 | |
struct | AlreadyOpen |
struct | CloseFailure |
struct | DrainFailure |
struct | FlushFailure |
struct | NotOpen |
struct | OpenFailure |
struct | ReadFailure |
struct | RTSFailure |
struct | WriteFailure |
Public 类型 | |
typedef int | file_handle_type |
Public 成员函数 | |
vrpn_SerialPort (const char *portname, long baud, int charsize=8, vrpn_SER_PARITY parity=vrpn_SER_PARITY_NONE) | |
Construct and open port | |
vrpn_SerialPort () | |
Construct without opening | |
~vrpn_SerialPort () | |
Destructor - closes port if open. | |
Open/Close Methods | |
void | open (const char *portname, long baud, int charsize=8, vrpn_SER_PARITY parity=vrpn_SER_PARITY_NONE) |
bool | is_open () const |
void | close () |
Close the serial port. | |
Write | |
| |
int | write (std::string const &buffer) |
int | write (const unsigned char *buffer, int bytes) |
Read | |
Read available characters from input buffer, up to indicated count. | |
int | read_available_characters (unsigned char *buffer, int count) |
std::string | read_available_characters (int count=-1) |
Read available characters from input buffer, up to indicated count (or -1 for no limit) | |
int | read_available_characters (unsigned char *buffer, int count, struct timeval &timeout) |
Read available characters from input buffer, and wait up to the indicated timeout for those remaining, up to indicated count. | |
std::string | read_available_characters (int count, struct timeval &timeout) |
Read available characters from input buffer, and wait up to the indicated timeout for those remaining, up to indicated count. | |
Buffer manipulation | |
void | flush_input_buffer () |
Throw out any characters within the input buffer. | |
void | flush_output_buffer () |
Throw out any characters (do not send) within the output buffer. | |
void | drain_output_buffer () |
Wait until all of the characters in the output buffer are sent, then return. | |
RTS | |
Set and clear functions for the RTS ("ready to send") hardware flow- control bit. These are used on a port that is already open. Some devices (like the Ascension Flock of Birds) use this to reset the device. | |
void | set_rts () |
void | clear_rts () |
void | assign_rts (bool set) |
A simple class wrapping the functionality of vrpn_Serial.h with RAII, object-orientation, and optional STL types
vrpn_SerialPort | ( | const char * | portname, |
long | baud, | ||
int | charsize = 8, | ||
vrpn_SER_PARITY | parity = vrpn_SER_PARITY_NONE ) |
vrpn_SerialPort | ( | ) |
Construct without opening
~vrpn_SerialPort | ( | ) |
Destructor - closes port if open.
void close | ( | ) |
Close the serial port.
void drain_output_buffer | ( | ) |
Wait until all of the characters in the output buffer are sent, then return.
void flush_input_buffer | ( | ) |
Throw out any characters within the input buffer.
void flush_output_buffer | ( | ) |
Throw out any characters (do not send) within the output buffer.
std::string read_available_characters | ( | int | count, |
struct timeval & | timeout ) |
Read available characters from input buffer, and wait up to the indicated timeout for those remaining, up to indicated count.
std::string read_available_characters | ( | int | count = -1 | ) |
Read available characters from input buffer, up to indicated count (or -1 for no limit)
int read_available_characters | ( | unsigned char * | buffer, |
int | count, | ||
struct timeval & | timeout ) |
Read available characters from input buffer, and wait up to the indicated timeout for those remaining, up to indicated count.