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

Method onErrorOccurred

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

* @brief Handles Modbus device errors by showing a message box. */

Source from the content-addressed store, hash-verified

1360 * @brief Handles Modbus device errors by showing a message box.
1361 */
1362void IO::Drivers::Modbus::onErrorOccurred(QModbusDevice::Error error)
1363{
1364 if (!m_device || m_connecting)
1365 return;
1366
1367 if (error == QModbusDevice::NoError)
1368 return;
1369
1370 QString errorString = m_device->errorString();
1371 if (errorString.isEmpty())
1372 errorString = tr("Error code: %1").arg(static_cast<int>(error));
1373
1374 Misc::Utilities::showMessageBox(
1375 tr("Modbus Communication Error"), errorString, QMessageBox::Warning);
1376}
1377
1378/**
1379 * @brief Refreshes the list of available serial ports.

Callers

nothing calls this directly

Calls 2

errorStringMethod · 0.80
isEmptyMethod · 0.80

Tested by

no test coverage detected