#include <osaSerialPort.h>
Inheritance diagram for osaSerialPort:


Create a serial port for sending and receiving data.
Definition at line 51 of file osaSerialPort.h.
Type used to define the baud rate.
Definition at line 63 of file osaSerialPort.h.
Type used to define the character size.
Definition at line 84 of file osaSerialPort.h.
Type used to define the parity checking.
Definition at line 99 of file osaSerialPort.h.
Type used to define the flow control.
Definition at line 111 of file osaSerialPort.h.
| osaSerialPort::osaSerialPort | ( | void | ) | [inline] |
Default constructor. Set parameters to default 8N1 (8 bits per character, no parity checking, 1 stop bit) and 9600 baud rate. This constructor doesn't start anything, use Open() to actually start the serial port connection.
Definition at line 125 of file osaSerialPort.h.
| virtual osaSerialPort::~osaSerialPort | ( | void | ) | [virtual] |
Destructor.
| void osaSerialPort::SetBaudRate | ( | const BaudRateType & | baudRate | ) | [inline] |
Set a different baud rate.
Definition at line 147 of file osaSerialPort.h.
References CMN_LOG_CLASS_INIT_VERBOSE.
| void osaSerialPort::SetCharacterSize | ( | const CharacterSizeType & | characterSize | ) | [inline] |
Set a different character size.
Definition at line 154 of file osaSerialPort.h.
References CMN_LOG_CLASS_INIT_VERBOSE.
| void osaSerialPort::SetParityChecking | ( | const ParityCheckingType & | parityChecking | ) | [inline] |
Set a different parity checking.
Definition at line 161 of file osaSerialPort.h.
References CMN_LOG_CLASS_INIT_VERBOSE.
| void osaSerialPort::SetStopBits | ( | const StopBitsType & | stopBits | ) | [inline] |
Set different stop bits.
Definition at line 168 of file osaSerialPort.h.
References CMN_LOG_CLASS_INIT_VERBOSE.
| void osaSerialPort::SetFlowControl | ( | const FlowControlType & | flowControl | ) | [inline] |
Set different flow control.
Definition at line 175 of file osaSerialPort.h.
References CMN_LOG_CLASS_INIT_VERBOSE.
| void osaSerialPort::SetPortName | ( | const std::string & | portName | ) | [inline] |
Set the port name. For a more portable code, use SetPortNumber.
Definition at line 182 of file osaSerialPort.h.
| std::string osaSerialPort::GetPortName | ( | void | ) | const [inline] |
Get the current port name.
Definition at line 187 of file osaSerialPort.h.
| std::string osaSerialPort::SetPortNumber | ( | unsigned int | portNumber | ) |
Set the serial port name based on a number, starting from 1.
| bool osaSerialPort::Open | ( | bool | blocking = false |
) |
Open the serial port. This method starts the serial port based on the parameters previously set (either the defaults of those defined by SetBaudRate, SetCharacterSize, SetParityChecking, SetHardwareFlowControl, ...).
| bool osaSerialPort::IsOpened | ( | void | ) | const [inline] |
Indicates if the port has been opened or closed correctly.
Definition at line 205 of file osaSerialPort.h.
| int osaSerialPort::Write | ( | const char * | data, | |
| int | nBytes | |||
| ) |
Send raw data.
| int osaSerialPort::Read | ( | char * | data, | |
| int | nBytes | |||
| ) |
Receive raw data.
| bool osaSerialPort::WriteBreak | ( | double | breakLengthInSeconds | ) |
Sends a serial break for a given duration in seconds.
On Linux, if the break duration is set to 0, the actual duration will be at least 0.25 seconds and at most 0.5 seconds.
On Mac OS, the implementation doesn't use the breakLengthInSeconds. To provide a similar runtime, osaSleep is used internaly. As the default duration on MacOS it 0.4 seconds, the actual sleep time is breakLengthInSeconds - 0.4.
On Windows, this method is implemented using SetCommBreak, osaSleep and ClearCommBreak.
| bool osaSerialPort::Flush | ( | void | ) |
Flush.