* @brief Get list of parity options */
| 728 | * @brief Get list of parity options |
| 729 | */ |
| 730 | API::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 |
nothing calls this directly
no test coverage detected