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

Method close

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

* @brief Closes the serial port and clears its signal/slot connections. */

Source from the content-addressed store, hash-verified

118 * @brief Closes the serial port and clears its signal/slot connections.
119 */
120void IO::Drivers::UART::close()
121{
122 if (port() != nullptr) {
123 disconnect(port(), &QSerialPort::errorOccurred, this, &IO::Drivers::UART::handleError);
124 disconnect(port(), &QIODevice::readyRead, this, &IO::Drivers::UART::onReadyRead);
125
126 if (dtrEnabled())
127 port()->setDataTerminalReady(false);
128
129 port()->close();
130 port()->deleteLater();
131 }
132
133 m_port = nullptr;
134 m_usingCustomSerialPort = false;
135
136 Q_EMIT portChanged();
137 Q_EMIT availablePortsChanged();
138}
139
140/**
141 * @brief Returns true when the serial port is open.

Callers 1

~UARTMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected