MCPcopy Create free account
hub / github.com/Serial-Studio/Serial-Studio / setFlowControl

Method setFlowControl

app/src/IO/Drivers/UART.cpp:694–723  ·  view source on GitHub ↗

* @brief Changes the flow control option of the serial port. */

Source from the content-addressed store, hash-verified

692 * @brief Changes the flow control option of the serial port.
693 */
694void 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.

Callers 1

openMethod · 0.45

Calls 1

countMethod · 0.45

Tested by

no test coverage detected