DynExp
Highly flexible laboratory automation for dynamically changing experiments.
|
Qt worker for serial/COM port communication in a separate thread. More...
Public Slots | |
void | Init (QString PortName, QSerialPort::BaudRate BaudRate, QSerialPort::DataBits DataBits, QSerialPort::StopBits StopBits, QSerialPort::Parity Parity) |
Initializes HardwareAdapterSerialPortWorker::Port for serial communication with the given settings. More... | |
Public Slots inherited from DynExp::QSerialCommunicationHardwareAdapterWorker | |
void | Open () |
Opens the communication connection. More... | |
void | Close () |
Closes the communication connection. More... | |
void | Reset () |
Resets the worker and the communication connection. More... | |
void | Clear () |
Clears the communication connection's buffers and state. More... | |
void | Flush () |
Flushes the communication connection's buffers. More... | |
void | Read () |
Reads from the communication connection's hardware interface. More... | |
void | Write (const QString String) |
Writes String to the communication connection's hardware interface. More... | |
void | Write_endl () |
Writes end of the line character(s) to the communication connection's hardware interface. More... | |
Public Member Functions | |
HardwareAdapterSerialPortWorker () | |
virtual | ~HardwareAdapterSerialPortWorker () |
Public Member Functions inherited from DynExp::QSerialCommunicationHardwareAdapterWorker | |
QSerialCommunicationHardwareAdapterWorker ()=default | |
virtual | ~QSerialCommunicationHardwareAdapterWorker ()=0 |
Public Member Functions inherited from Util::QWorker | |
void | MoveToWorkerThread (DynExp::ItemIDType ID) |
Moves the instance to DynExpCore's worker thread. Do not call from constructor since derived classes have not been instantiated yet in that case. This would prevent QObjects contained in derived classes to be also moved to the worker thread. More... | |
auto | GetOwner () const noexcept |
Returns this worker instance's owner. More... | |
Private Slots | |
void | OnDataAvailable () |
Qt slot called when Port has received data which can be read. More... | |
Private Member Functions | |
bool | CheckError (const std::source_location Location=std::source_location::current()) const |
Checks whether Port is in an error state. If this is the case, sets an exception using QSerialCommunicationHardwareAdapterWorker::SetException(). More... | |
virtual void | OpenChild () override |
Opens the communication connection. More... | |
virtual void | CloseChild () override |
Closes the communication connection. More... | |
virtual void | ResetChild () override |
Resets the worker and the communication connection. More... | |
virtual void | ClearChild () override |
Clears the communication connection's buffers and state. More... | |
virtual void | FlushChild () override |
Flushes the communication connection's buffers. More... | |
virtual void | ReadChild () override |
Reads from the communication connection's hardware interface. More... | |
virtual void | WriteChild (const QString &String) override |
Writes String to the communication connection's hardware interface. More... | |
virtual void | Write_endl_Child () override |
Writes end of the line character(s) to the communication connection's hardware interface. More... | |
Private Attributes | |
QSerialPort | Port |
COM port for serial communication. More... | |
Additional Inherited Members | |
Protected Member Functions inherited from DynExp::QSerialCommunicationHardwareAdapterWorker | |
void | SetCommunicationChannelOpened () const noexcept |
Calls QSerialCommunicationHardwareAdapter::SetCommunicationChannelOpened on QWorker::Owner. Does nothing if QWorker::Owner is nullptr. More... | |
void | SetCommunicationChannelClosed () const noexcept |
Calls QSerialCommunicationHardwareAdapter::SetCommunicationChannelClosed on QWorker::Owner. Does nothing if QWorker::Owner is nullptr. More... | |
void | DataRead (const std::string &String) const |
Calls QSerialCommunicationHardwareAdapter::DataRead on QWorker::Owner. Does nothing if QWorker::Owner is nullptr. More... | |
template<typename ExceptionType > | |
void | SetException (const ExceptionType &Exception) const |
Calls QSerialCommunicationHardwareAdapter::SetException on QWorker::Owner. Does nothing if QWorker::Owner is nullptr. More... | |
Protected Member Functions inherited from Util::QWorker | |
QWorker ()=default | |
~QWorker ()=default | |
Qt worker for serial/COM port communication in a separate thread.
Definition at line 96 of file HardwareAdapterSerialPort.h.
DynExp::HardwareAdapterSerialPortWorker::HardwareAdapterSerialPortWorker | ( | ) |
Definition at line 30 of file HardwareAdapterSerialPort.cpp.
|
inlinevirtual |
Definition at line 102 of file HardwareAdapterSerialPort.h.
|
private |
Checks whether Port is in an error state. If this is the case, sets an exception using QSerialCommunicationHardwareAdapterWorker::SetException().
Location | Location from which this function is called. Do not pass anything. |
Definition at line 52 of file HardwareAdapterSerialPort.cpp.
|
overrideprivatevirtual |
Clears the communication connection's buffers and state.
Implements DynExp::QSerialCommunicationHardwareAdapterWorker.
Definition at line 92 of file HardwareAdapterSerialPort.cpp.
|
overrideprivatevirtual |
Closes the communication connection.
Implements DynExp::QSerialCommunicationHardwareAdapterWorker.
Definition at line 74 of file HardwareAdapterSerialPort.cpp.
|
overrideprivatevirtual |
Flushes the communication connection's buffers.
Implements DynExp::QSerialCommunicationHardwareAdapterWorker.
Definition at line 98 of file HardwareAdapterSerialPort.cpp.
|
slot |
Initializes HardwareAdapterSerialPortWorker::Port for serial communication with the given settings.
PortName | COM port name |
BaudRate | Baud rate |
DataBits | Amount of data bits |
StopBits | Amount of stop bits |
Parity | Parity setting |
Definition at line 36 of file HardwareAdapterSerialPort.cpp.
|
privateslot |
Qt slot called when Port has received data which can be read.
Definition at line 47 of file HardwareAdapterSerialPort.cpp.
|
overrideprivatevirtual |
Opens the communication connection.
Implements DynExp::QSerialCommunicationHardwareAdapterWorker.
Definition at line 64 of file HardwareAdapterSerialPort.cpp.
|
overrideprivatevirtual |
Reads from the communication connection's hardware interface.
Implements DynExp::QSerialCommunicationHardwareAdapterWorker.
Definition at line 104 of file HardwareAdapterSerialPort.cpp.
|
overrideprivatevirtual |
Resets the worker and the communication connection.
Implements DynExp::QSerialCommunicationHardwareAdapterWorker.
Definition at line 85 of file HardwareAdapterSerialPort.cpp.
|
overrideprivatevirtual |
Writes end of the line character(s) to the communication connection's hardware interface.
Implements DynExp::QSerialCommunicationHardwareAdapterWorker.
Definition at line 123 of file HardwareAdapterSerialPort.cpp.
|
overrideprivatevirtual |
Writes String
to the communication connection's hardware interface.
Implements DynExp::QSerialCommunicationHardwareAdapterWorker.
Definition at line 113 of file HardwareAdapterSerialPort.cpp.
|
private |
COM port for serial communication.
Definition at line 138 of file HardwareAdapterSerialPort.h.