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

Method close

app/src/IO/Drivers/SlcanBackend.cpp:205–221  ·  view source on GitHub ↗

* @brief Closes the slcan channel and the serial port. */

Source from the content-addressed store, hash-verified

203 * @brief Closes the slcan channel and the serial port.
204 */
205void IO::Drivers::SlcanBackend::close()
206{
207 setState(QCanBusDevice::ClosingState);
208
209 if (m_port) {
210 if (m_port->isOpen()) {
211 (void)sendCommand(QByteArrayLiteral("C\r"));
212 m_port->close();
213 }
214
215 m_port->deleteLater();
216 m_port = nullptr;
217 }
218
219 m_rxBuffer.clear();
220 setState(QCanBusDevice::UnconnectedState);
221}
222
223/**
224 * @brief Encodes a QCanBusFrame as a LAWICEL command and writes it to the port.

Callers 1

openMethod · 0.45

Calls 2

isOpenMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected