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

Method getParityList

app/src/API/Handlers/ModbusHandler.cpp:730–750  ·  view source on GitHub ↗

* @brief Get list of parity options */

Source from the content-addressed store, hash-verified

728 * @brief Get list of parity options
729 */
730API::CommandResponse API::Handlers::ModbusHandler::getParityList(const QString& id,
731 const QJsonObject& params)
732{
733 Q_UNUSED(params)
734
735 const auto& parityList = IO::ConnectionManager::instance().modbus()->parityList();
736
737 QJsonArray parities;
738 for (int i = 0; i < parityList.count(); ++i) {
739 QJsonObject parity;
740 parity[QStringLiteral("index")] = i;
741 parity[QStringLiteral("name")] = parityList.at(i);
742 parities.append(parity);
743 }
744
745 QJsonObject result;
746 result[QStringLiteral("parityList")] = parities;
747 result[QStringLiteral("currentParityIndex")] =
748 IO::ConnectionManager::instance().modbus()->parityIndex();
749 return CommandResponse::makeSuccess(id, result);
750}
751
752/**
753 * @brief Get list of data bits options

Callers

nothing calls this directly

Calls 5

modbusMethod · 0.80
parityListMethod · 0.45
countMethod · 0.45
appendMethod · 0.45
parityIndexMethod · 0.45

Tested by

no test coverage detected