SGSerialPort Class Reference

A class to encapsulate low level serial port IO. More...

#include <serial.hxx>

List of all members.

Public Member Functions

 SGSerialPort ()
 Default constructor.
 SGSerialPort (const string &device, int baud)
 Constructor.
 ~SGSerialPort ()
 Destructor.
bool open_port (const string &device)
 Open a the serial port.
bool close_port ()
 Close the serial port.
bool set_baud (int baud)
 Set baud rate.
string read_port ()
 Read from the serial port.
int read_port (char *buf, int len)
 Read from the serial port.
int write_port (const string &value)
 Write to the serial port.
int write_port (const char *buf, int len)
 Write to the serial port.
bool is_enabled ()

Detailed Description

A class to encapsulate low level serial port IO.

Definition at line 50 of file serial.hxx.


Constructor & Destructor Documentation

SGSerialPort::SGSerialPort ( const string &  device,
int  baud 
)

Constructor.

Parameters:
device device name
baud baud rate

Definition at line 47 of file serial.cxx.


Member Function Documentation

bool SGSerialPort::close_port (  ) 

Close the serial port.

Returns:
success/failure

Definition at line 149 of file serial.cxx.

bool SGSerialPort::is_enabled (  )  [inline]
Returns:
true if device open

Definition at line 121 of file serial.hxx.

bool SGSerialPort::open_port ( const string &  device  ) 

Open a the serial port.

Parameters:
device name of device
Returns:
success/failure

Definition at line 61 of file serial.cxx.

int SGSerialPort::read_port ( char *  buf,
int  len 
)

Read from the serial port.

Parameters:
buf input buffer
len length of buffer (i.e. max number of bytes to read
Returns:
number of bytes read

Definition at line 327 of file serial.cxx.

string SGSerialPort::read_port (  ) 

Read from the serial port.

Returns:
line of data

Definition at line 271 of file serial.cxx.

bool SGSerialPort::set_baud ( int  baud  ) 

Set baud rate.

Parameters:
baud baud rate
Returns:
success/failure

Definition at line 162 of file serial.cxx.

int SGSerialPort::write_port ( const char *  buf,
int  len 
)

Write to the serial port.

Parameters:
buf pointer to character buffer containing output data
len number of bytes to write from the buffer
Returns:
number of bytes written

Definition at line 459 of file serial.cxx.

int SGSerialPort::write_port ( const string &  value  ) 

Write to the serial port.

Parameters:
value output string
Returns:
number of bytes written

Definition at line 384 of file serial.cxx.


The documentation for this class was generated from the following files:

Generated on 23 Feb 2010 for SimGear by  doxygen 1.6.1