Merge PR #515: Allow modbus RTU plugins to request a connection reset

pull/510/head
jenkins 2022-05-03 23:27:13 +02:00
commit dbcbbfcf97
3 changed files with 10 additions and 0 deletions

View File

@ -167,6 +167,12 @@ bool ModbusRtuMasterImpl::connected() const
return m_connected;
}
void ModbusRtuMasterImpl::requestReconnect()
{
disconnectDevice();
connectDevice();
}
bool ModbusRtuMasterImpl::connectDevice()
{
#ifdef WITH_QTSERIALBUS

View File

@ -68,6 +68,8 @@ public:
bool connected() const override;
void requestReconnect() override;
bool connectDevice();
void disconnectDevice();

View File

@ -54,6 +54,8 @@ public:
virtual bool connected() const = 0;
virtual void requestReconnect() = 0;
// Requests
virtual ModbusRtuReply *readCoil(int slaveAddress, int registerAddress, quint16 size = 1) = 0;
virtual ModbusRtuReply *readDiscreteInput(int slaveAddress, int registerAddress, quint16 size = 1) = 0;