* @brief Handles Modbus device errors by showing a message box. */
| 1360 | * @brief Handles Modbus device errors by showing a message box. |
| 1361 | */ |
| 1362 | void 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. |
nothing calls this directly
no test coverage detected