* @brief Closes the serial port. */
| 240 | * @brief Closes the serial port. |
| 241 | */ |
| 242 | void IO::Drivers::SeeedCanBackend::close() |
| 243 | { |
| 244 | setState(QCanBusDevice::ClosingState); |
| 245 | |
| 246 | if (m_port) { |
| 247 | if (m_port->isOpen()) |
| 248 | m_port->close(); |
| 249 | |
| 250 | m_port->deleteLater(); |
| 251 | m_port = nullptr; |
| 252 | } |
| 253 | |
| 254 | m_rxBuffer.clear(); |
| 255 | setState(QCanBusDevice::UnconnectedState); |
| 256 | } |
| 257 | |
| 258 | /** |
| 259 | * @brief Encodes a QCanBusFrame as a variable-length analyzer packet and writes it. |