* @brief Registers the UART line-settings commands (baud / parity / bits / flow). */
| 36 | * @brief Registers the UART line-settings commands (baud / parity / bits / flow). |
| 37 | */ |
| 38 | void API::Handlers::UARTHandler::registerLineSettings(CommandRegistry& registry) |
| 39 | { |
| 40 | static const QJsonArray kBaudRates = {110, |
| 41 | 150, |
| 42 | 300, |
| 43 | 1200, |
| 44 | 2400, |
| 45 | 4800, |
| 46 | 9600, |
| 47 | 19200, |
| 48 | 38400, |
| 49 | 57600, |
| 50 | 115200, |
| 51 | 230400, |
| 52 | 256000, |
| 53 | 460800, |
| 54 | 576000, |
| 55 | 921600}; |
| 56 | |
| 57 | registry.registerCommand( |
| 58 | QStringLiteral("io.uart.setBaudRate"), |
| 59 | QStringLiteral("Set baud rate (params: baudRate)"), |
| 60 | API::makeSchema({API::enumProp(QStringLiteral("baudRate"), |
| 61 | QStringLiteral("Baud rate in bits per second"), |
| 62 | kBaudRates, |
| 63 | 9600)}), |
| 64 | &setBaudRate); |
| 65 | registry.registerCommand( |
| 66 | QStringLiteral("io.uart.setParity"), |
| 67 | QStringLiteral("Set parity (params: parityIndex - 0=None, 1=Even, 2=Odd, 3=Space, 4=Mark)"), |
| 68 | API::makeSchema( |
| 69 | {API::enumProp(QStringLiteral("parityIndex"), |
| 70 | QStringLiteral("Parity index (0=None, 1=Even, 2=Odd, 3=Space, 4=Mark)"), |
| 71 | QJsonArray{0, 1, 2, 3, 4}, |
| 72 | 0)}), |
| 73 | &setParity); |
| 74 | registry.registerCommand( |
| 75 | QStringLiteral("io.uart.setDataBits"), |
| 76 | QStringLiteral("Set data bits (params: dataBitsIndex - 0=5, 1=6, 2=7, 3=8)"), |
| 77 | API::makeSchema({API::enumProp(QStringLiteral("dataBitsIndex"), |
| 78 | QStringLiteral("Data bits index (0=5, 1=6, 2=7, 3=8)"), |
| 79 | QJsonArray{0, 1, 2, 3}, |
| 80 | 3)}), |
| 81 | &setDataBits); |
| 82 | registry.registerCommand( |
| 83 | QStringLiteral("io.uart.setStopBits"), |
| 84 | QStringLiteral("Set stop bits (params: stopBitsIndex - 0=1, 1=1.5, 2=2)"), |
| 85 | API::makeSchema({API::enumProp(QStringLiteral("stopBitsIndex"), |
| 86 | QStringLiteral("Stop bits index (0=1, 1=1.5, 2=2)"), |
| 87 | QJsonArray{0, 1, 2}, |
| 88 | 0)}), |
| 89 | &setStopBits); |
| 90 | registry.registerCommand( |
| 91 | QStringLiteral("io.uart.setFlowControl"), |
| 92 | QStringLiteral("Set flow control (params: flowControlIndex - 0=None, 1=Hardware, 2=Software)"), |
| 93 | API::makeSchema( |
| 94 | {API::enumProp(QStringLiteral("flowControlIndex"), |
| 95 | QStringLiteral("Flow control index (0=None, 1=Hardware, 2=Software)"), |
nothing calls this directly
no test coverage detected