#include <port.h>
Inheritance diagram for Port:
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 | |
Port () | |
ctor | |
virtual | ~Port () |
dtor | |
virtual Error | open (const std::string &config)=0 |
virtual Error | close ()=0 |
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 | |
int | m_handle |
Port is the base class for a multimeter port (which in most of the cases would be a SerialPort). UNIX error values are translated to typesafe internal values which also can be translated into plain english strings.
Definition at line 34 of file port.h.
|
|
|
ctor
|
|
dtor
|
|
close the previously opened port Implemented in SerialPort. |
|
Translate errno into internal value
Definition at line 122 of file port.cpp. References BadAddress, BadFileDescriptor, Interrupted, Invalid, IOError, IsDirectory, NoData, and UnknownError. Referenced by readByte(), readString(), writeByte(), and writeString(). |
|
Translate Error code into a human readable string.
Definition at line 145 of file port.cpp. References BadAddress, BadFileDescriptor, ConfigError, Interrupted, Invalid, IOError, IsDirectory, NoData, NoSuchPort, Ok, OpenError, PermissionDenied, ReadError, SyntaxError, UnknownBaudRate, UnknownError, UnknownNumberOfBits, UnknownParity, UnknownStopBits, and WriteError. |
|
Open the port given a general purpose configuration string containing the description of the port.
Implemented in SerialPort. |
|
Read a byte from the port.
Definition at line 51 of file port.cpp. References errnoValue(), m_handle, and 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 errnoValue(), m_handle, and Ok. |
|
Write a byte to the port.
Definition at line 32 of file port.cpp. References errnoValue(), m_handle, and Ok. |
|
Write a string to the port.
Definition at line 72 of file port.cpp. References errnoValue(), m_handle, and Ok. Referenced by MetexAscii::run(). |
|
Definition at line 108 of file port.h. Referenced by SerialPort::close(), readByte(), readString(), writeByte(), and writeString(). |