Serial Class Reference

Interface to a serial port. More...

#include <Devices/Serial.H>

Inheritance diagram for Serial:
Inheritance graph
[legend]
Collaboration diagram for Serial:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 Serial (OptionManager &mgr, const std::string &descrName="Serial Port", const std::string &tagName="SerialPort")
 Constructor.
 ~Serial (void)
 destructor
void closePort ()
 Close the serial port device file.
void enablePort (std::string DeviceName)
 Enable the serial port.
void configure (const char *dev="", const int speed=9600, const char *format="8N1", const bool flowSoft=false, const bool flowHard=false, const int=0)
 Configure the port before it is started.
void configureSearch (const std::string DeviceDescription, const int speed=115200, const std::string SearchPrefix="ttyUSB", const char *format="8N1", const bool flowSoft=false, const bool flowHard=false, const int=0)
 Configure the serial port to search for a device.
serialError setSpeed (const int speed)
 Set serial port speed for both input and output.
serialError setFlowControl (const bool useHard, const bool useSoft)
 Set the serial port flow control on Input as well as Ouput.
serialError setCharBits (const int bits)
 Set character size.
serialError setParity (const bool useParity, const bool oddParity)
 Set parity mode.
serialError setStopBits (const int bits)
 Set number of stop bits.
serialError setBlocking (const bool blocking)
 Set the access to blocking or not.
void toggleDTR (const time_t millisec)
 Set the DTR mode off momentarily.
void sendBreak (void)
 transmit continuous stream of zero-valued bits for specific duration.
int read (void *buffer, const int nbytes)
 attempt to read up to nbytes from serial port into the buffer
std::vector< unsigned char > readFrame (const unsigned char frameStart, const unsigned char frameEnd=255, const int frameLength=-1, const double timeout=-1)
 Attempt to read a serial frame.
char read (void)
 attempts to get the next character from the serial port
int write (const void *buffer, const int nbytes)
 write bytes to the port
int write (const unsigned char character)
 write a single byte to the port - a simple wrapper around write(const void* buffer, const int nbytes)
void perror (void)
 print a verbal message indicating the last error.
void flush (void)
std::string getDeviceDescriptor ()
std::string getDevName ()
bool isSerialOk ()
int getSerialErrno ()
 Serial ()
 Constructor.
 ~Serial (void)
 destructor
void closePort ()
 Close the serial port device file.
void enablePort (std::string DeviceName)
 Enable the serial port.
void configure (const char *dev="", const int speed=9600, const char *format="8N1", const bool flowSoft=false, const bool flowHard=false, const int=0)
 Configure the port before it is started.
void configureSearch (const std::string DeviceDescription, const int speed=115200, const std::string SearchPrefix="ttyUSB", const char *format="8N1", const bool flowSoft=false, const bool flowHard=false, const int=0)
 Configure the serial port to search for a device.
serialError setSpeed (const int speed)
 Set serial port speed for both input and output.
serialError setFlowControl (const bool useHard, const bool useSoft)
 Set the serial port flow control on Input as well as Ouput.
serialError setCharBits (const int bits)
 Set character size.
serialError setParity (const bool useParity, const bool oddParity)
 Set parity mode.
serialError setStopBits (const int bits)
 Set number of stop bits.
serialError setBlocking (const bool blocking)
 Set the access to blocking or not.
void toggleDTR (const time_t millisec)
 Set the DTR mode off momentarily.
void sendBreak (void)
 transmit continuous stream of zero-valued bits for specific duration.
int read (void *buffer, const int nbytes)
 attempt to read up to nbytes from serial port into the buffer
std::vector< unsigned char > readFrame (const unsigned char frameStart, const unsigned char frameEnd=255, const int frameLength=-1, const double timeout=-1)
 Attempt to read a serial frame.
char read (void)
 attempts to get the next character from the serial port
int write (const void *buffer, const int nbytes)
 write bytes to the port
int write (const unsigned char character)
 write a single byte to the port - a simple wrapper around write(const void* buffer, const int nbytes)
void perror (void)
 print a verbal message indicating the last error.
void flush (void)
std::string getDeviceDescriptor ()
std::string getDevName ()
bool isSerialOk ()
int getSerialErrno ()
void start ()
 open the port and get started
void stop ()
 close the port and get stopped
 Serial ()
 Constructor.
 ~Serial (void)
 destructor
void closePort ()
 Close the serial port device file.
void enablePort (std::string DeviceName)
 Enable the serial port.
void configure (const char *dev="", const int speed=9600, const char *format="8N1", const bool flowSoft=false, const bool flowHard=false, const int=0)
 Configure the port before it is started.
void configureSearch (const std::string DeviceDescription, const int speed=115200, const std::string SearchPrefix="ttyUSB", const char *format="8N1", const bool flowSoft=false, const bool flowHard=false, const int=0)
 Configure the serial port to search for a device.
serialError setSpeed (const int speed)
 Set serial port speed for both input and output.
serialError setFlowControl (const bool useHard, const bool useSoft)
 Set the serial port flow control on Input as well as Ouput.
serialError setCharBits (const int bits)
 Set character size.
serialError setParity (const bool useParity, const bool oddParity)
 Set parity mode.
serialError setStopBits (const int bits)
 Set number of stop bits.
serialError setBlocking (const bool blocking)
 Set the access to blocking or not.
void toggleDTR (const time_t millisec)
 Set the DTR mode off momentarily.
void sendBreak (void)
 transmit continuous stream of zero-valued bits for specific duration.
int read (void *buffer, const int nbytes)
 attempt to read up to nbytes from serial port into the buffer
std::vector< unsigned char > readFrame (const unsigned char frameStart, const unsigned char frameEnd=255, const int frameLength=-1, const double timeout=-1)
 Attempt to read a serial frame.
char read (void)
 attempts to get the next character from the serial port
int write (const void *buffer, const int nbytes)
 write bytes to the port
int write (const unsigned char character)
 write a single byte to the port - a simple wrapper around write(const void* buffer, const int nbytes)
void perror (void)
 print a verbal message indicating the last error.
void flush (void)
std::string getDeviceDescriptor ()
std::string getDevName ()
bool isSerialOk ()
int getSerialErrno ()
void start ()
 open the port and get started
void stop ()
 close the port and get stopped

Protected Member Functions

void start2 ()
 open the port and get started
void stop2 ()
 close the port and get stopped

Protected Attributes

OModelParam< std::stringitsCmdDevName
 device name passed from cmd line
NModelParam< std::stringitsDeviceDescription
 device description to seach for
NModelParam< std::stringitsSearchPrefix
 device name prefix (e.g. ttyUSB)
NModelParam< int > itsBaud
 Baudrate.
NModelParam< int > itsCharBits
 number of useful bits per char
NModelParam< int > itsStopBits
 number of stop bits
NModelParam< bool > itsUseParity
 use parity if true
NModelParam< bool > itsParityOdd
 parity is odd if true, otherwise even
NModelParam< bool > itsFlowHard
 use hardware flow control if true
NModelParam< bool > itsFlowSoft
 use software flow control if true
NModelParam< int > itsRdTout
 read timeout in 1/10000s
NModelParam< bool > itsBlocking
 use blocking mode
NModelParam< bool > itsSerialOk
 Port opened success if true.
std::string itsCmdDevName
 device name passed from cmd line
std::string itsDeviceDescription
 device description to seach for
std::string itsSearchPrefix
 device name prefix (e.g. ttyUSB)
int itsBaud
 Baudrate.
int itsCharBits
 number of useful bits per char
int itsStopBits
 number of stop bits
bool itsUseParity
 use parity if true
bool itsParityOdd
 parity is odd if true, otherwise even
bool itsFlowHard
 use hardware flow control if true
bool itsFlowSoft
 use software flow control if true
int itsRdTout
 read timeout in 1/10000s
bool itsBlocking
 use blocking mode
bool itsSerialOk
 Port opened success if true.

Detailed Description

Interface to a serial port.

The port will be open at start() time; see ModelComponent.H for details. Because typically one may use several serial ports with different configs, this ModelComponent does not export any command-line option (there would be too many otherwise if many ports are used). Typically, thus, the port can be configured either via config files or using the various access functions provided in this class.

Definition at line 86 of file Serial.H.


Constructor & Destructor Documentation

Serial::Serial ( OptionManager mgr,
const std::string descrName = "Serial Port",
const std::string tagName = "SerialPort" 
)

Constructor.

Definition at line 58 of file Serial.C.

Serial::~Serial ( void   ) 

destructor

Definition at line 786 of file Serial.C.

Serial::Serial (  ) 

Constructor.

Definition at line 55 of file Serial.C.

Serial::~Serial ( void   ) 

destructor

Serial::Serial (  ) 

Constructor.

Serial::~Serial ( void   ) 

destructor


Member Function Documentation

void Serial::closePort (  ) 

Close the serial port device file.

void Serial::closePort (  ) 

Close the serial port device file.

void Serial::closePort (  ) 

Close the serial port device file.

Definition at line 179 of file Serial.C.

Referenced by enablePort(), stop(), and stop2().

void Serial::configure ( const char *  dev = "",
const int  speed = 9600,
const char *  format = "8N1",
const bool  flowSoft = false,
const bool  flowHard = false,
const   int = 0 
)

Configure the port before it is started.

This will update our internal ModelParam values to the specified ones; thus this should be called before start(). In contrast, the setXXX functions below are for reconfiguration at runtime, once the port is already open and running. This function is provided as a shortcut to set a bunch of ModelParam values in one simple call.

Parameters:
dev device name (e.g., "/dev/ttyS0")
speed speed in bauds. See setSpeed() for valid values
format a 3-char string for charbits, parity, and stop bits; for example "8N1"; parity should be "N", "E" or "O".
flowSoft use software flow control if true
flowHard use hardware flow control if true
tout read timeout in 1/10000s or 0 for no timeout
void Serial::configure ( const char *  dev = "",
const int  speed = 9600,
const char *  format = "8N1",
const bool  flowSoft = false,
const bool  flowHard = false,
const   int = 0 
)

Configure the port before it is started.

This will update our internal ModelParam values to the specified ones; thus this should be called before start(). In contrast, the setXXX functions below are for reconfiguration at runtime, once the port is already open and running. This function is provided as a shortcut to set a bunch of ModelParam values in one simple call.

Parameters:
dev device name (e.g., "/dev/ttyS0")
speed speed in bauds. See setSpeed() for valid values
format a 3-char string for charbits, parity, and stop bits; for example "8N1"; parity should be "N", "E" or "O".
flowSoft use software flow control if true
flowHard use hardware flow control if true
tout read timeout in 1/10000s or 0 for no timeout
void Serial::configure ( const char *  dev = "",
const int  speed = 9600,
const char *  format = "8N1",
const bool  flowSoft = false,
const bool  flowHard = false,
const int  tout = 0 
)

Configure the port before it is started.

This will update our internal ModelParam values to the specified ones; thus this should be called before start(). In contrast, the setXXX functions below are for reconfiguration at runtime, once the port is already open and running. This function is provided as a shortcut to set a bunch of ModelParam values in one simple call.

Parameters:
dev device name (e.g., "/dev/ttyS0")
speed speed in bauds. See setSpeed() for valid values
format a 3-char string for charbits, parity, and stop bits; for example "8N1"; parity should be "N", "E" or "O".
flowSoft use software flow control if true
flowHard use hardware flow control if true
tout read timeout in 1/10000s or 0 for no timeout

Definition at line 203 of file Serial.C.

References itsBaud, itsCharBits, itsFlowHard, itsFlowSoft, itsParityOdd, itsRdTout, itsStopBits, itsUseParity, and NModelParam< T >::setVal().

Referenced by configureSearch().

void Serial::configureSearch ( const std::string  DeviceDescription,
const int  speed = 115200,
const std::string  SearchPrefix = "ttyUSB",
const char *  format = "8N1",
const bool  flowSoft = false,
const bool  flowHard = false,
const   int = 0 
)

Configure the serial port to search for a device.

void Serial::configureSearch ( const std::string  DeviceDescription,
const int  speed = 115200,
const std::string  SearchPrefix = "ttyUSB",
const char *  format = "8N1",
const bool  flowSoft = false,
const bool  flowHard = false,
const   int = 0 
)

Configure the serial port to search for a device.

void Serial::configureSearch ( const std::string  DeviceDescription,
const int  speed = 115200,
const std::string  SearchPrefix = "ttyUSB",
const char *  format = "8N1",
const bool  flowSoft = false,
const bool  flowHard = false,
const int  tout = 0 
)

Configure the serial port to search for a device.

Definition at line 188 of file Serial.C.

References configure(), itsDeviceDescription, itsSearchPrefix, and NModelParam< T >::setVal().

void Serial::enablePort ( std::string  DeviceName  ) 

Enable the serial port.

enablePort will do all of the work of actually setting the config properties that have been requested, as well as opening the device file, etc...

void Serial::enablePort ( std::string  DeviceName  ) 

Enable the serial port.

enablePort will do all of the work of actually setting the config properties that have been requested, as well as opening the device file, etc...

void Serial::enablePort ( std::string  DeviceName  ) 

Enable the serial port.

enablePort will do all of the work of actually setting the config properties that have been requested, as well as opening the device file, etc...

Definition at line 144 of file Serial.C.

References closePort(), NModelParam< T >::getVal(), itsBaud, itsBlocking, itsCharBits, itsFlowHard, itsFlowSoft, itsParityOdd, itsUseParity, perror(), setBlocking(), setCharBits(), setFlowControl(), setParity(), and setSpeed().

Referenced by start(), and start2().

void Serial::perror ( void   ) 

print a verbal message indicating the last error.

void Serial::perror ( void   ) 

print a verbal message indicating the last error.

void Serial::perror ( void   ) 

print a verbal message indicating the last error.

Definition at line 727 of file Serial.C.

Referenced by enablePort().

char Serial::read ( void   ) 

attempts to get the next character from the serial port

for comptability with dirk's code

int Serial::read ( void *  buffer,
const int  nbytes 
)

attempt to read up to nbytes from serial port into the buffer

Parameters:
buffer holds bytes after read number of bytes to attempt to read
Returns:
0 on a timeout, -1 on error, number of bytes actually read on a success
char Serial::read ( void   ) 

attempts to get the next character from the serial port

for comptability with dirk's code

int Serial::read ( void *  buffer,
const int  nbytes 
)

attempt to read up to nbytes from serial port into the buffer

Parameters:
buffer holds bytes after read number of bytes to attempt to read
Returns:
0 on a timeout, -1 on error, number of bytes actually read on a success
char Serial::read ( void   ) 

attempts to get the next character from the serial port

for comptability with dirk's code

Definition at line 579 of file Serial.C.

Referenced by read(), and readFrame().

int Serial::read ( void *  buffer,
const int  nbytes 
)

attempt to read up to nbytes from serial port into the buffer

Parameters:
buffer holds bytes after read number of bytes to attempt to read
Returns:
0 on a timeout, -1 on error, number of bytes actually read on a success

Definition at line 565 of file Serial.C.

References read().

std::vector<unsigned char> Serial::readFrame ( const unsigned char  frameStart,
const unsigned char  frameEnd = 255,
const int  frameLength = -1,
const double  timeout = -1 
)

Attempt to read a serial frame.

The frame returned by the device should have the following format: [start byte] [optional number of data bytes] [data...] ... [...data] [end byte]

Parameters:
frameStart holds the byte signifying the start of the frame
frameEnd holds the byte signifying the end of the frame
frameLength optionally specifies the number of bytes in the frame. If this is -1, then the second byte of the frame is assumed to contain the total number of bytes in the frame.
timeout the number of seconds to wait before giving up (default of -1 is no timeout)
Returns:
the data contained in the frame
std::vector<unsigned char> Serial::readFrame ( const unsigned char  frameStart,
const unsigned char  frameEnd = 255,
const int  frameLength = -1,
const double  timeout = -1 
)

Attempt to read a serial frame.

The frame returned by the device should have the following format: [start byte] [optional number of data bytes] [data...] ... [...data] [end byte]

Parameters:
frameStart holds the byte signifying the start of the frame
frameEnd holds the byte signifying the end of the frame
frameLength optionally specifies the number of bytes in the frame. If this is -1, then the second byte of the frame is assumed to contain the total number of bytes in the frame.
timeout the number of seconds to wait before giving up (default of -1 is no timeout)
Returns:
the data contained in the frame
std::vector< unsigned char > Serial::readFrame ( const unsigned char  frameStart,
const unsigned char  frameEnd = 255,
const int  frameLength = -1,
const double  timeout = -1 
)

Attempt to read a serial frame.

The frame returned by the device should have the following format: [start byte] [optional number of data bytes] [data...] ... [...data] [end byte]

Parameters:
frameStart holds the byte signifying the start of the frame
frameEnd holds the byte signifying the end of the frame
frameLength optionally specifies the number of bytes in the frame. If this is -1, then the second byte of the frame is assumed to contain the total number of bytes in the frame.
timeout the number of seconds to wait before giving up (default of -1 is no timeout)
Returns:
the data contained in the frame

Definition at line 588 of file Serial.C.

References Timer::getSecs(), read(), and Timer::reset().

Referenced by start(), and start2().

void Serial::sendBreak ( void   ) 

transmit continuous stream of zero-valued bits for specific duration.

void Serial::sendBreak ( void   ) 

transmit continuous stream of zero-valued bits for specific duration.

void Serial::sendBreak ( void   ) 

transmit continuous stream of zero-valued bits for specific duration.

Definition at line 471 of file Serial.C.

serialError Serial::setBlocking ( const bool  blocking  ) 

Set the access to blocking or not.

If blocking, a write will block until all data has actually been sent through; otherwise it will return immediately while the data is being transmitted.

serialError Serial::setBlocking ( const bool  blocking  ) 

Set the access to blocking or not.

If blocking, a write will block until all data has actually been sent through; otherwise it will return immediately while the data is being transmitted.

serialError Serial::setBlocking ( const bool  blocking  ) 

Set the access to blocking or not.

If blocking, a write will block until all data has actually been sent through; otherwise it will return immediately while the data is being transmitted.

Definition at line 435 of file Serial.C.

References itsBlocking, and NModelParam< T >::setVal().

Referenced by enablePort().

serialError Serial::setCharBits ( const int  bits  ) 

Set character size.

This function is to change the char size while already started.

Returns:
0 on success.
Parameters:
bits character size to use; valid values are 5, 6, 7, 8.
serialError Serial::setCharBits ( const int  bits  ) 

Set character size.

This function is to change the char size while already started.

Returns:
0 on success.
Parameters:
bits character size to use; valid values are 5, 6, 7, 8.
serialError Serial::setCharBits ( const int  bits  ) 

Set character size.

This function is to change the char size while already started.

Returns:
0 on success.
Parameters:
bits character size to use; valid values are 5, 6, 7, 8.

Definition at line 347 of file Serial.C.

References itsCharBits, and NModelParam< T >::setVal().

Referenced by enablePort().

serialError Serial::setFlowControl ( const bool  useHard,
const bool  useSoft 
)

Set the serial port flow control on Input as well as Ouput.

This function is to change the flow control while already started.

Parameters:
useHard use hardware flow control if true
useSoft use software flow control if true
Returns:
0 or serialErrSuccess on success
serialError Serial::setFlowControl ( const bool  useHard,
const bool  useSoft 
)

Set the serial port flow control on Input as well as Ouput.

This function is to change the flow control while already started.

Parameters:
useHard use hardware flow control if true
useSoft use software flow control if true
Returns:
0 or serialErrSuccess on success
serialError Serial::setFlowControl ( const bool  useHard,
const bool  useSoft 
)

Set the serial port flow control on Input as well as Ouput.

This function is to change the flow control while already started.

Parameters:
useHard use hardware flow control if true
useSoft use software flow control if true
Returns:
0 or serialErrSuccess on success

Definition at line 319 of file Serial.C.

References itsFlowHard, itsFlowSoft, and NModelParam< T >::setVal().

Referenced by enablePort().

serialError Serial::setParity ( const bool  useParity,
const bool  oddParity 
)

Set parity mode.

This function is to change the parity while already started.

Parameters:
useParity use some parity if true
oddParity parity is odd if true, otherwise even
Returns:
0 on success.
serialError Serial::setParity ( const bool  useParity,
const bool  oddParity 
)

Set parity mode.

This function is to change the parity while already started.

Parameters:
useParity use some parity if true
oddParity parity is odd if true, otherwise even
Returns:
0 on success.
serialError Serial::setParity ( const bool  useParity,
const bool  oddParity 
)

Set parity mode.

This function is to change the parity while already started.

Parameters:
useParity use some parity if true
oddParity parity is odd if true, otherwise even
Returns:
0 on success.

Definition at line 379 of file Serial.C.

References itsParityOdd, itsUseParity, and NModelParam< T >::setVal().

Referenced by enablePort().

serialError Serial::setSpeed ( const int  speed  ) 

Set serial port speed for both input and output.

This function is to change the speed while already started.

Parameters:
speed to select. 0 signifies modem "hang up" and possible values are 0, 110, 300, 600, 1200, 2400, 4800, 9600, 19200, 38400, 57600, 115200.
Returns:
0 or serialErrSuccess on success. The perror() method can be used to print a longer description of the error.
serialError Serial::setSpeed ( const int  speed  ) 

Set serial port speed for both input and output.

This function is to change the speed while already started.

Parameters:
speed to select. 0 signifies modem "hang up" and possible values are 0, 110, 300, 600, 1200, 2400, 4800, 9600, 19200, 38400, 57600, 115200.
Returns:
0 or serialErrSuccess on success. The perror() method can be used to print a longer description of the error.
serialError Serial::setSpeed ( const int  speed  ) 

Set serial port speed for both input and output.

This function is to change the speed while already started.

Parameters:
speed to select. 0 signifies modem "hang up" and possible values are 0, 110, 300, 600, 1200, 2400, 4800, 9600, 19200, 38400, 57600, 115200.
Returns:
0 or serialErrSuccess on success. The perror() method can be used to print a longer description of the error.

Definition at line 240 of file Serial.C.

References itsBaud, and NModelParam< T >::setVal().

Referenced by enablePort().

serialError Serial::setStopBits ( const int  bits  ) 

Set number of stop bits.

This function is to change the stop bits while started.

Returns:
0 on success.
Parameters:
bits stop bits (only values 1 and 2 are valid).
serialError Serial::setStopBits ( const int  bits  ) 

Set number of stop bits.

This function is to change the stop bits while started.

Returns:
0 on success.
Parameters:
bits stop bits (only values 1 and 2 are valid).
serialError Serial::setStopBits ( const int  bits  ) 

Set number of stop bits.

This function is to change the stop bits while started.

Returns:
0 on success.
Parameters:
bits stop bits (only values 1 and 2 are valid).

Definition at line 410 of file Serial.C.

References itsStopBits, and NModelParam< T >::setVal().

void Serial::start (  ) 

open the port and get started

Reimplemented from ModelComponent.

void Serial::start (  ) 

open the port and get started

Reimplemented from ModelComponent.

Definition at line 77 of file Serial.C.

References enablePort(), itsCmdDevName, itsDeviceDescription, itsSearchPrefix, readFrame(), and write().

void Serial::start2 (  )  [protected, virtual]
void Serial::stop (  ) 

close the port and get stopped

Reimplemented from ModelComponent.

void Serial::stop (  ) 

close the port and get stopped

Reimplemented from ModelComponent.

Definition at line 167 of file Serial.C.

References closePort().

void Serial::stop2 (  )  [protected, virtual]

close the port and get stopped

Reimplemented from ModelComponent.

Definition at line 173 of file Serial.C.

References closePort().

void Serial::toggleDTR ( const time_t  millisec  ) 

Set the DTR mode off momentarily.

Parameters:
millisec number of milliseconds.
void Serial::toggleDTR ( const time_t  millisec  ) 

Set the DTR mode off momentarily.

Parameters:
millisec number of milliseconds.
void Serial::toggleDTR ( const time_t  millisec  ) 

Set the DTR mode off momentarily.

Parameters:
millisec number of milliseconds.

Definition at line 448 of file Serial.C.

int Serial::write ( const unsigned char  character  ) 

write a single byte to the port - a simple wrapper around write(const void* buffer, const int nbytes)

Parameters:
character the single byte to write
Returns:
-1 on failure, 1 on successs.
int Serial::write ( const void *  buffer,
const int  nbytes 
)

write bytes to the port

Parameters:
buffer begin writing from the location buffer.
nbytes number of bytes to write
Returns:
-1 on failure, number of bytes written on success
int Serial::write ( const unsigned char  character  ) 

write a single byte to the port - a simple wrapper around write(const void* buffer, const int nbytes)

Parameters:
character the single byte to write
Returns:
-1 on failure, 1 on successs.
int Serial::write ( const void *  buffer,
const int  nbytes 
)

write bytes to the port

Parameters:
buffer begin writing from the location buffer.
nbytes number of bytes to write
Returns:
-1 on failure, number of bytes written on success
int Serial::write ( const unsigned char  character  ) 

write a single byte to the port - a simple wrapper around write(const void* buffer, const int nbytes)

Parameters:
character the single byte to write
Returns:
-1 on failure, 1 on successs.

Definition at line 710 of file Serial.C.

References write().

int Serial::write ( const void *  buffer,
const int  nbytes 
)

write bytes to the port

Parameters:
buffer begin writing from the location buffer.
nbytes number of bytes to write
Returns:
-1 on failure, number of bytes written on success

Definition at line 685 of file Serial.C.

Referenced by start(), start2(), and write().


Member Data Documentation

int Serial::itsBaud [protected]

Baudrate.

Definition at line 237 of file Serial.H.

int Serial::itsBaud [protected]

Baudrate.

Definition at line 235 of file Serial.H.

Referenced by configure(), enablePort(), and setSpeed().

bool Serial::itsBlocking [protected]

use blocking mode

Definition at line 245 of file Serial.H.

bool Serial::itsBlocking [protected]

use blocking mode

Definition at line 243 of file Serial.H.

Referenced by enablePort(), and setBlocking().

int Serial::itsCharBits [protected]

number of useful bits per char

Definition at line 238 of file Serial.H.

int Serial::itsCharBits [protected]

number of useful bits per char

Definition at line 236 of file Serial.H.

Referenced by configure(), enablePort(), and setCharBits().

device name passed from cmd line

Definition at line 233 of file Serial.H.

device name passed from cmd line

Definition at line 228 of file Serial.H.

Referenced by start(), and start2().

device description to seach for

Definition at line 235 of file Serial.H.

device description to seach for

Definition at line 233 of file Serial.H.

Referenced by configureSearch(), start(), and start2().

bool Serial::itsFlowHard [protected]

use hardware flow control if true

Definition at line 242 of file Serial.H.

bool Serial::itsFlowHard [protected]

use hardware flow control if true

Definition at line 240 of file Serial.H.

Referenced by configure(), enablePort(), and setFlowControl().

bool Serial::itsFlowSoft [protected]

use software flow control if true

Definition at line 243 of file Serial.H.

bool Serial::itsFlowSoft [protected]

use software flow control if true

Definition at line 241 of file Serial.H.

Referenced by configure(), enablePort(), and setFlowControl().

bool Serial::itsParityOdd [protected]

parity is odd if true, otherwise even

Definition at line 241 of file Serial.H.

bool Serial::itsParityOdd [protected]

parity is odd if true, otherwise even

Definition at line 239 of file Serial.H.

Referenced by configure(), enablePort(), and setParity().

int Serial::itsRdTout [protected]

read timeout in 1/10000s

Definition at line 244 of file Serial.H.

int Serial::itsRdTout [protected]

read timeout in 1/10000s

Definition at line 242 of file Serial.H.

Referenced by configure().

device name prefix (e.g. ttyUSB)

Definition at line 236 of file Serial.H.

device name prefix (e.g. ttyUSB)

Definition at line 234 of file Serial.H.

Referenced by configureSearch(), start(), and start2().

bool Serial::itsSerialOk [protected]

Port opened success if true.

Definition at line 246 of file Serial.H.

bool Serial::itsSerialOk [protected]

Port opened success if true.

Definition at line 244 of file Serial.H.

int Serial::itsStopBits [protected]

number of stop bits

Definition at line 239 of file Serial.H.

int Serial::itsStopBits [protected]

number of stop bits

Definition at line 237 of file Serial.H.

Referenced by configure(), and setStopBits().

bool Serial::itsUseParity [protected]

use parity if true

Definition at line 240 of file Serial.H.

bool Serial::itsUseParity [protected]

use parity if true

Definition at line 238 of file Serial.H.

Referenced by configure(), enablePort(), and setParity().


The documentation for this class was generated from the following files:
Generated on Sun May 8 08:24:54 2011 for iLab Neuromorphic Vision Toolkit by  doxygen 1.6.3