* @brief Applies the Modbus slave option to the active Modbus driver. */
| 906 | * @brief Applies the Modbus slave option to the active Modbus driver. |
| 907 | */ |
| 908 | static void applyModbusSlave(const QCommandLineParser& parser, const QCommandLineOption& opt) |
| 909 | { |
| 910 | if (!parser.isSet(opt)) |
| 911 | return; |
| 912 | |
| 913 | bool ok = false; |
| 914 | unsigned int slave_val = parser.value(opt).toUInt(&ok); |
| 915 | if (!ok || slave_val < 1 || slave_val > 247) { |
| 916 | qWarning() << "Invalid ModBus slave address (1-247):" << parser.value(opt); |
| 917 | return; |
| 918 | } |
| 919 | |
| 920 | IO::ConnectionManager::instance().modbus()->setSlaveAddress(static_cast<quint8>(slave_val)); |
| 921 | } |
| 922 | |
| 923 | /** |
| 924 | * @brief Applies the Modbus poll-interval option to the active Modbus driver. |
no test coverage detected