#include <serialport.h>
Inheritance diagram for SerialPort:
Public Types | |
enum | Error { Ok = 0, SyntaxError, PermissionDenied, NoSuchPort, ConfigError, OpenError, WriteError, ReadError, UnknownBaudRate, UnknownNumberOfBits, UnknownParity, UnknownStopBits, NoData, BadFileDescriptor, BadAddress, Interrupted, Invalid, IOError, IsDirectory, UnknownError } |
Public Member Functions | |
SerialPort () | |
virtual | ~SerialPort () |
virtual Port::Error | open (const std::string &config) |
Open the serial port. | |
virtual Port::Error | close () |
virtual Error | writeByte (int byte) const |
virtual Error | readByte (int *byte) const |
virtual Error | writeString (const char *string, ssize_t len) const |
virtual Error | readString (char *string, ssize_t len) const |
Static Public Member Functions | |
static const char * | errorString (Error err) |
Protected Member Functions | |
Error | errnoValue () const |
Protected Attributes | |
termios | m_oldSettings |
int | m_handle |
Definition at line 33 of file serialport.h.
|
|
|
Definition at line 26 of file serialport.cpp. |
|
Definition at line 31 of file serialport.cpp. References close(). |
|
close the previously opened port Implements Port. Definition at line 236 of file serialport.cpp. References Port::m_handle, m_oldSettings, and Port::Ok. Referenced by VC820::close(), PeakTech10Ascii::close(), MetexAscii::close(), M9803R::close(), GDM703::close(), Escort97::close(), GDM703::~GDM703(), M9803R::~M9803R(), Metex14BytesContinuous::~Metex14BytesContinuous(), MetexAscii::~MetexAscii(), PeakTech10Ascii::~PeakTech10Ascii(), ~SerialPort(), and VC820::~VC820(). |
|
Translate errno into internal value
Definition at line 122 of file port.cpp. References Port::BadAddress, Port::BadFileDescriptor, Port::Interrupted, Port::Invalid, Port::IOError, Port::IsDirectory, Port::NoData, and Port::UnknownError. Referenced by Port::readByte(), Port::readString(), Port::writeByte(), and Port::writeString(). |
|
Translate Error code into a human readable string.
Definition at line 145 of file port.cpp. References Port::BadAddress, Port::BadFileDescriptor, Port::ConfigError, Port::Interrupted, Port::Invalid, Port::IOError, Port::IsDirectory, Port::NoData, Port::NoSuchPort, Port::Ok, Port::OpenError, Port::PermissionDenied, Port::ReadError, Port::SyntaxError, Port::UnknownBaudRate, Port::UnknownError, Port::UnknownNumberOfBits, Port::UnknownParity, Port::UnknownStopBits, and Port::WriteError. |
|
Open the serial port.
bits might be 5, 6, 7 or 8 parity might be n (none), e (even) or o (odd) stopbits might be 1 or 2 The optional RTS, DTR, DSR, CTS parameter can be used to force these signals to be set. This can be usefull for multimeter that use optocouplers. These guys sometimes are powered with one of these signals. For most multimeter a good starting point would be: DTR:DSR:CTS
Example: Implements Port. Definition at line 36 of file serialport.cpp. References Util::tokenize(). Referenced by VC820::open_impl(), PeakTech10Ascii::open_impl(), MetexAscii::open_impl(), M9803R::open_impl(), GDM703::open_impl(), and Escort97::open_impl(). |
|
Read a byte from the port.
Definition at line 51 of file port.cpp. References Port::errnoValue(), Port::m_handle, and Port::Ok. Referenced by VC820::readData(), PeakTech10Ascii::readData(), and DMMClass::readData(). |
|
Read a string from the port.
Definition at line 97 of file port.cpp. References Port::errnoValue(), Port::m_handle, and Port::Ok. |
|
Write a byte to the port.
Definition at line 32 of file port.cpp. References Port::errnoValue(), Port::m_handle, and Port::Ok. |
|
Write a string to the port.
Definition at line 72 of file port.cpp. References Port::errnoValue(), Port::m_handle, and Port::Ok. Referenced by MetexAscii::run(). |
|
Definition at line 108 of file port.h. Referenced by close(), Port::readByte(), Port::readString(), Port::writeByte(), and Port::writeString(). |
|
Definition at line 61 of file serialport.h. Referenced by close(). |