RflySimSDK v4.01
RflySimSDK说明文档
载入中...
搜索中...
未找到
vrpn_SerialPort类 参考

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

Open serial port

参见
vrpn_open_commport
异常
OpenFailure,AlreadyOpen
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
返回
number of bytes written
异常
WriteFailure,NotOpen
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.

异常
ReadFailure,NotOpen
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.

异常
RTSFailure,NotOpen
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() [1/2]

vrpn_SerialPort ( const char * portname,
long baud,
int charsize = 8,
vrpn_SER_PARITY parity = vrpn_SER_PARITY_NONE )

Construct and open port

参见
vrpn_open_commport
异常
OpenFailure
这是这个函数的调用关系图:

◆ vrpn_SerialPort() [2/2]

Construct without opening

◆ ~vrpn_SerialPort()

Destructor - closes port if open.

成员函数说明

◆ close()

void close ( )

Close the serial port.

异常
NotOpen,CloseFailure

◆ drain_output_buffer()

void drain_output_buffer ( )

Wait until all of the characters in the output buffer are sent, then return.

函数调用图:

◆ flush_input_buffer()

void flush_input_buffer ( )

Throw out any characters within the input buffer.

异常
FlushFailure,NotOpen

◆ flush_output_buffer()

void flush_output_buffer ( )

Throw out any characters (do not send) within the output buffer.

异常
FlushFailure,NotOpen

◆ read_available_characters() [1/3]

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.

◆ read_available_characters() [2/3]

std::string read_available_characters ( int count = -1)

Read available characters from input buffer, up to indicated count (or -1 for no limit)

◆ read_available_characters() [3/3]

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.


该类的文档由以下文件生成: