DynExp
Highly flexible laboratory automation for dynamically changing experiments.
|
Qt worker for network communication in a separate thread. More...
Public Slots | |
void | Init (QString ServerName, quint16 Port) |
Initializes HardwareAdapterTcpSocketWorker::Socket for TCP 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 | |
HardwareAdapterTcpSocketWorker () | |
virtual | ~HardwareAdapterTcpSocketWorker () |
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 | OnConnected () |
Qt slot called when Socket has been connected. Calls QSerialCommunicationHardwareAdapterWorker::SetCommunicationChannelOpened(). More... | |
void | OnDisconnected () |
Qt slot called when Socket has been disconnected. Calls QSerialCommunicationHardwareAdapterWorker::SetCommunicationChannelClosed(). More... | |
void | OnErrorOccurred (QAbstractSocket::SocketError SocketError) |
Qt slot called when Socket transitioned into an error state. Calls QSerialCommunicationHardwareAdapterWorker::SetException() to store a NetworkException constructed from SocketError . More... | |
void | OnDataAvailable () |
Qt slot called when Socket has received data which can be read. Calls QSerialCommunicationHardwareAdapterWorker::Read(). More... | |
Private Member Functions | |
bool | IsOpen () const noexcept |
Checks whether Socket is connected. More... | |
bool | IsOpening () const noexcept |
Checks whether Socket is connecting right now. 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 | |
QString | ServerName |
IP address to connect to. More... | |
quint16 | Port |
Network port to connect to. More... | |
QTcpSocket | Socket |
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 network communication in a separate thread.
Definition at line 109 of file HardwareAdapterEthernet.h.
DynExp::HardwareAdapterTcpSocketWorker::HardwareAdapterTcpSocketWorker | ( | ) |
Definition at line 9 of file HardwareAdapterEthernet.cpp.
|
inlinevirtual |
Definition at line 115 of file HardwareAdapterEthernet.h.
|
overrideprivatevirtual |
Clears the communication connection's buffers and state.
Implements DynExp::QSerialCommunicationHardwareAdapterWorker.
Definition at line 77 of file HardwareAdapterEthernet.cpp.
|
overrideprivatevirtual |
Closes the communication connection.
Implements DynExp::QSerialCommunicationHardwareAdapterWorker.
Definition at line 65 of file HardwareAdapterEthernet.cpp.
|
overrideprivatevirtual |
Flushes the communication connection's buffers.
Implements DynExp::QSerialCommunicationHardwareAdapterWorker.
Definition at line 82 of file HardwareAdapterEthernet.cpp.
|
slot |
Initializes HardwareAdapterTcpSocketWorker::Socket for TCP communication with the given settings.
ServerName | IP address |
Port | Network port |
Definition at line 21 of file HardwareAdapterEthernet.cpp.
|
privatenoexcept |
Checks whether Socket is connected.
Definition at line 47 of file HardwareAdapterEthernet.cpp.
|
privatenoexcept |
Checks whether Socket is connecting right now.
Definition at line 53 of file HardwareAdapterEthernet.cpp.
|
privateslot |
Qt slot called when Socket has been connected. Calls QSerialCommunicationHardwareAdapterWorker::SetCommunicationChannelOpened().
Definition at line 27 of file HardwareAdapterEthernet.cpp.
|
privateslot |
Qt slot called when Socket has received data which can be read. Calls QSerialCommunicationHardwareAdapterWorker::Read().
Definition at line 42 of file HardwareAdapterEthernet.cpp.
|
privateslot |
Qt slot called when Socket has been disconnected. Calls QSerialCommunicationHardwareAdapterWorker::SetCommunicationChannelClosed().
Definition at line 32 of file HardwareAdapterEthernet.cpp.
|
privateslot |
Qt slot called when Socket transitioned into an error state. Calls QSerialCommunicationHardwareAdapterWorker::SetException() to store a NetworkException
constructed from SocketError
.
SocketError | Information about the error occurred to Socket. |
Definition at line 37 of file HardwareAdapterEthernet.cpp.
|
overrideprivatevirtual |
Opens the communication connection.
Implements DynExp::QSerialCommunicationHardwareAdapterWorker.
Definition at line 59 of file HardwareAdapterEthernet.cpp.
|
overrideprivatevirtual |
Reads from the communication connection's hardware interface.
Implements DynExp::QSerialCommunicationHardwareAdapterWorker.
Definition at line 88 of file HardwareAdapterEthernet.cpp.
|
overrideprivatevirtual |
Resets the worker and the communication connection.
Implements DynExp::QSerialCommunicationHardwareAdapterWorker.
Definition at line 71 of file HardwareAdapterEthernet.cpp.
|
overrideprivatevirtual |
Writes end of the line character(s) to the communication connection's hardware interface.
Implements DynExp::QSerialCommunicationHardwareAdapterWorker.
Definition at line 103 of file HardwareAdapterEthernet.cpp.
|
overrideprivatevirtual |
Writes String
to the communication connection's hardware interface.
Implements DynExp::QSerialCommunicationHardwareAdapterWorker.
Definition at line 96 of file HardwareAdapterEthernet.cpp.
|
private |
Network port to connect to.
Definition at line 176 of file HardwareAdapterEthernet.h.
|
private |
IP address to connect to.
Definition at line 175 of file HardwareAdapterEthernet.h.
|
private |
COM port for serial communication.
Definition at line 178 of file HardwareAdapterEthernet.h.