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

Method onStateChanged

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

* @brief Handles Modbus device state changes by starting/stopping the poll timer. */

Source from the content-addressed store, hash-verified

1339 * @brief Handles Modbus device state changes by starting/stopping the poll timer.
1340 */
1341void IO::Drivers::Modbus::onStateChanged(QModbusDevice::State state)
1342{
1343 if (!m_device)
1344 return;
1345
1346 if (state == QModbusDevice::ConnectedState) {
1347 if (m_pollTimer && !m_pollTimer->isActive())
1348 m_pollTimer->start(m_pollInterval);
1349 }
1350
1351 else if (state == QModbusDevice::UnconnectedState) {
1352 if (m_pollTimer)
1353 m_pollTimer->stop();
1354 }
1355
1356 Q_EMIT configurationChanged();
1357}
1358
1359/**
1360 * @brief Handles Modbus device errors by showing a message box.

Callers

nothing calls this directly

Calls 3

isActiveMethod · 0.45
startMethod · 0.45
stopMethod · 0.45

Tested by

no test coverage detected