MCPcopy Create free account
hub / github.com/Serial-Studio/Serial-Studio / doClose

Method doClose

app/src/IO/Drivers/Modbus.cpp:241–261  ·  view source on GitHub ↗

* @brief Non-virtual cleanup implementation shared by close() and ~Modbus(). */

Source from the content-addressed store, hash-verified

239 * @brief Non-virtual cleanup implementation shared by close() and ~Modbus().
240 */
241void IO::Drivers::Modbus::doClose()
242{
243 if (m_pollTimer)
244 m_pollTimer->stop();
245
246 if (m_lastReply) {
247 disconnect(m_lastReply, nullptr, this, nullptr);
248 m_lastReply->deleteLater();
249 m_lastReply = nullptr;
250 }
251
252 if (m_device) {
253 disconnect(m_device, nullptr, this, nullptr);
254
255 if (m_device->state() != QModbusDevice::UnconnectedState)
256 m_device->disconnectDevice();
257
258 m_device->deleteLater();
259 m_device = nullptr;
260 }
261}
262
263/**
264 * @brief Returns true when the Modbus device is connected.

Callers

nothing calls this directly

Calls 2

disconnectDeviceMethod · 0.80
stopMethod · 0.45

Tested by

no test coverage detected