* @brief Changes the flow control option of the serial port. */
| 692 | * @brief Changes the flow control option of the serial port. |
| 693 | */ |
| 694 | void IO::Drivers::UART::setFlowControl(const quint8 flowControlIndex) |
| 695 | { |
| 696 | if (flowControlIndex >= flowControlList().count()) { |
| 697 | qWarning() << "UART::setFlowControl: index" << flowControlIndex << "out of range"; |
| 698 | return; |
| 699 | } |
| 700 | |
| 701 | if (m_flowControlIndex == flowControlIndex) |
| 702 | return; |
| 703 | |
| 704 | m_flowControlIndex = flowControlIndex; |
| 705 | m_settings.setValue("UartDriver/flowControl", flowControlIndex); |
| 706 | |
| 707 | switch (flowControlIndex) { |
| 708 | case 0: |
| 709 | m_flowControl = QSerialPort::NoFlowControl; |
| 710 | break; |
| 711 | case 1: |
| 712 | m_flowControl = QSerialPort::HardwareControl; |
| 713 | break; |
| 714 | case 2: |
| 715 | m_flowControl = QSerialPort::SoftwareControl; |
| 716 | break; |
| 717 | } |
| 718 | |
| 719 | if (port()) |
| 720 | port()->setFlowControl(flowControl()); |
| 721 | |
| 722 | Q_EMIT flowControlChanged(); |
| 723 | } |
| 724 | |
| 725 | /** |
| 726 | * @brief Scans for available serial ports and rebuilds the device list. |