* @brief Applies the Modbus stop-bits option to the active Modbus driver. */
| 885 | * @brief Applies the Modbus stop-bits option to the active Modbus driver. |
| 886 | */ |
| 887 | static void applyModbusStopBits(const QString& stopBits) |
| 888 | { |
| 889 | static const QHash<QString, quint8> kStopBits = { |
| 890 | { QStringLiteral("1"), 0}, |
| 891 | {QStringLiteral("1.5"), 1}, |
| 892 | { QStringLiteral("2"), 2}, |
| 893 | }; |
| 894 | |
| 895 | const auto it = kStopBits.constFind(stopBits); |
| 896 | if (it == kStopBits.cend()) { |
| 897 | qWarning() << "Invalid ModBus stop bits (1/1.5/2):" << stopBits; |
| 898 | IO::ConnectionManager::instance().modbus()->setStopBitsIndex(0); |
| 899 | return; |
| 900 | } |
| 901 | |
| 902 | IO::ConnectionManager::instance().modbus()->setStopBitsIndex(it.value()); |
| 903 | } |
| 904 | |
| 905 | /** |
| 906 | * @brief Applies the Modbus slave option to the active Modbus driver. |
no test coverage detected