* @brief Get list of stop bits options */
| 778 | * @brief Get list of stop bits options |
| 779 | */ |
| 780 | API::CommandResponse API::Handlers::ModbusHandler::getStopBitsList(const QString& id, |
| 781 | const QJsonObject& params) |
| 782 | { |
| 783 | Q_UNUSED(params) |
| 784 | |
| 785 | const auto& stopBitsList = IO::ConnectionManager::instance().modbus()->stopBitsList(); |
| 786 | |
| 787 | QJsonArray stopBitsArray; |
| 788 | for (int i = 0; i < stopBitsList.count(); ++i) { |
| 789 | QJsonObject stopBits; |
| 790 | stopBits[QStringLiteral("index")] = i; |
| 791 | stopBits[QStringLiteral("value")] = stopBitsList.at(i); |
| 792 | stopBitsArray.append(stopBits); |
| 793 | } |
| 794 | |
| 795 | QJsonObject result; |
| 796 | result[QStringLiteral("stopBitsList")] = stopBitsArray; |
| 797 | result[QStringLiteral("currentStopBitsIndex")] = |
| 798 | IO::ConnectionManager::instance().modbus()->stopBitsIndex(); |
| 799 | return CommandResponse::makeSuccess(id, result); |
| 800 | } |
| 801 | |
| 802 | /** |
| 803 | * @brief Get list of baud rate options |
nothing calls this directly
no test coverage detected