latest version v1.9 - last update 10 Apr 2010 |
the parameters for the class serial More...
#include <ltiSerial.h>
Public Types | |
enum | ePortType { Com1 = 0, Com2, Com3, Com4, Com5, Com6, Com7, Com8, USB0, USB1 } |
enum | eBaudRateType { Baud0, Baud300, Baud600, Baud1200, Baud1800, Baud2400, Baud4800, Baud9600, Baud19200, Baud38400, Baud57600, Baud76800, Baud115200 } |
enum | eCharBitSizeType { Cs4 = 4, Cs5, Cs6, Cs7, Cs8 } |
enum | eStopBitType { One, OneFive, Two } |
enum | eParityType { No, Even, Odd, Space, Mark } |
Public Member Functions | |
parameters () | |
parameters (const parameters &other) | |
virtual | ~parameters () |
const char * | getTypeName () const |
parameters & | copy (const parameters &other) |
parameters & | operator= (const parameters &other) |
virtual parameters * | clone () const |
virtual bool | write (ioHandler &handler, const bool &complete=true) const |
virtual bool | read (ioHandler &handler, const bool &complete=true) |
Public Attributes | |
eBaudRateType | baudRate |
ePortType | port |
eCharBitSizeType | characterSize |
eParityType | parity |
eStopBitType | stopBits |
int | receiveTimeout |
the parameters for the class serial
Type to specify the baud rate.
Baud rate is a measure of the number of times per second a signal in a communications channel varies, or makes a transition between states (states being frequencies, voltage levels, or phase angles). One baud is one such change. Thus, a 1200-baud modem's signal changes state 1200 times each second. The number of bits transmitted in a second (baudrate in bits-per-second (bps) ) depends on the modulation technique being used. A 2400 baud modem can transmit 9400 bps if there are 4 bits/baud.
Type to specificy the port to be used.
lti::serial::parameters::parameters | ( | ) |
default constructor
lti::serial::parameters::parameters | ( | const parameters & | other | ) |
copy constructor
other | the parameters object to be copied |
virtual lti::serial::parameters::~parameters | ( | ) | [virtual] |
destructor
virtual parameters* lti::serial::parameters::clone | ( | ) | const [virtual] |
returns a pointer to a clone of the parameters
parameters& lti::serial::parameters::copy | ( | const parameters & | other | ) |
copy the contents of a parameters object
other | the parameters object to be copied |
Reimplemented from lti::ioObject.
const char* lti::serial::parameters::getTypeName | ( | ) | const [virtual] |
returns name of this type
Reimplemented from lti::ioObject.
parameters& lti::serial::parameters::operator= | ( | const parameters & | other | ) |
copy the contents of a parameters object
other | the parameters object to be copied |
Reimplemented from lti::ioObject.
virtual bool lti::serial::parameters::read | ( | ioHandler & | handler, | |
const bool & | complete = true | |||
) | [virtual] |
write the parameters in the given ioHandler
handler | the ioHandler to be used | |
complete | if true (the default) the enclosing begin/end will be also written, otherwise only the data block will be written. |
virtual bool lti::serial::parameters::write | ( | ioHandler & | handler, | |
const bool & | complete = true | |||
) | const [virtual] |
write the parameters in the given ioHandler
handler | the ioHandler to be used | |
complete | if true (the default) the enclosing begin/end will be also written, otherwise only the data block will be written. |
Baud rate.
Default value: Baud9600
Character size.
Default value: Cs8
Parity.
Default value: No
Which serial port.
Default value: Com1
Receive timeout in milliseconds.
If you specify zero, then no timeout will exist. The receive method will check if there is something in the buffer. If so, then it will normally return (reading the first character in the serial FIFO). If there is nothing in the buffer, the receive() method will return inmediatly a "false" value.
You should consider that for Linux systems the expected timeout precision is in deciseconds. The given value will be rounded to the best decisecond precision. For example 1 ms will be rounded to 0 ms, 80ms will be rounded to 0.1s.
Windows OS accepts the ms value.
Default value: 5000 (i.e. 5 seconds)
Stop bits Default: One.