* @brief Changes the stop bits of the serial port. */
| 645 | * @brief Changes the stop bits of the serial port. |
| 646 | */ |
| 647 | void IO::Drivers::UART::setStopBits(const quint8 stopBitsIndex) |
| 648 | { |
| 649 | if (stopBitsIndex >= stopBitsList().count()) { |
| 650 | qWarning() << "UART::setStopBits: index" << stopBitsIndex << "out of range"; |
| 651 | return; |
| 652 | } |
| 653 | |
| 654 | if (m_stopBitsIndex == stopBitsIndex) |
| 655 | return; |
| 656 | |
| 657 | m_stopBitsIndex = stopBitsIndex; |
| 658 | m_settings.setValue("UartDriver/stopBits", stopBitsIndex); |
| 659 | |
| 660 | switch (stopBitsIndex) { |
| 661 | case 0: |
| 662 | m_stopBits = QSerialPort::OneStop; |
| 663 | break; |
| 664 | case 1: |
| 665 | m_stopBits = QSerialPort::OneAndHalfStop; |
| 666 | break; |
| 667 | case 2: |
| 668 | m_stopBits = QSerialPort::TwoStop; |
| 669 | break; |
| 670 | } |
| 671 | |
| 672 | if (port()) |
| 673 | port()->setStopBits(stopBits()); |
| 674 | |
| 675 | Q_EMIT stopBitsChanged(); |
| 676 | } |
| 677 | |
| 678 | /** |
| 679 | * @brief Enables or disables the auto-reconnect feature. |