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

Function applyModbusPoll

app/src/Misc/CLI.cpp:926–939  ·  view source on GitHub ↗

* @brief Applies the Modbus poll-interval option to the active Modbus driver. */

Source from the content-addressed store, hash-verified

924 * @brief Applies the Modbus poll-interval option to the active Modbus driver.
925 */
926static void applyModbusPoll(const QCommandLineParser& parser, const QCommandLineOption& opt)
927{
928 if (!parser.isSet(opt))
929 return;
930
931 bool ok = false;
932 quint16 interval = parser.value(opt).toUInt(&ok);
933 if (!ok || interval < 50 || interval > 60000) {
934 qWarning() << "Invalid ModBus poll interval (50-60000 ms):" << parser.value(opt);
935 return;
936 }
937
938 IO::ConnectionManager::instance().modbus()->setPollInterval(interval);
939}
940
941/**
942 * @brief Applies the Modbus serial baud-rate option to the active Modbus driver.

Callers 2

Calls 3

modbusMethod · 0.80
valueMethod · 0.45
setPollIntervalMethod · 0.45

Tested by

no test coverage detected