From 48dd861d033c7a68d58fdf714a9adb2707de4bd0 Mon Sep 17 00:00:00 2001 From: Alex Spataru Date: Sun, 17 Nov 2024 19:38:00 -0500 Subject: [PATCH] Remove payloadReceived() signal from HAL_Driver --- app/src/IO/HAL_Driver.h | 45 ------------------------------------ app/src/IO/Manager.cpp | 4 ---- app/src/JSON/FrameParser.cpp | 6 ++--- 3 files changed, 3 insertions(+), 52 deletions(-) diff --git a/app/src/IO/HAL_Driver.h b/app/src/IO/HAL_Driver.h index aa63981f..6a9c22b2 100644 --- a/app/src/IO/HAL_Driver.h +++ b/app/src/IO/HAL_Driver.h @@ -40,72 +40,27 @@ namespace IO */ class HAL_Driver : public QObject { - // clang-format off Q_OBJECT - // clang-format on signals: - /** - * @brief Emitted when the driver's configuration changes. - */ void configurationChanged(); - - /** - * @brief Emitted when data is successfully written to the device. - */ void dataSent(const QByteArray &data); - - /** - * @brief Emitted when data is received and should be appended to a buffer. - */ void dataReceived(const QByteArray &data); - /** - * @brief Emitted when data is received and should be processed directly. - */ - void payloadReceived(const QByteArray &data); - public: /** * @brief Close the device connection. */ virtual void close() = 0; - /** - * @brief Check if the device is open. - */ [[nodiscard]] virtual bool isOpen() const = 0; - - /** - * @brief Check if the device is ready for reading. - */ [[nodiscard]] virtual bool isReadable() const = 0; - - /** - * @brief Check if the device is ready for writing. - */ [[nodiscard]] virtual bool isWritable() const = 0; - - /** - * @brief Check if the device configuration is valid. - */ [[nodiscard]] virtual bool configurationOk() const = 0; - - /** - * @brief Write data to the device. Returns the number of bytes written. - */ [[nodiscard]] virtual quint64 write(const QByteArray &data) = 0; - - /** - * @brief Open the device in the specified mode. - */ [[nodiscard]] virtual bool open(const QIODevice::OpenMode mode) = 0; protected: - /** - * Process incoming data. - * @param data The received data to process. - */ void processData(const QByteArray &data) { QByteArray dataCopy(data); diff --git a/app/src/IO/Manager.cpp b/app/src/IO/Manager.cpp index 5bb99cf8..53b28e63 100644 --- a/app/src/IO/Manager.cpp +++ b/app/src/IO/Manager.cpp @@ -303,8 +303,6 @@ void IO::Manager::connectDevice() { connect(driver(), &IO::HAL_Driver::dataReceived, &m_frameReader, &FrameReader::processData, Qt::QueuedConnection); - connect(driver(), &IO::HAL_Driver::payloadReceived, this, - &IO::Manager::processPayload, Qt::QueuedConnection); } // Error opening the device @@ -330,8 +328,6 @@ void IO::Manager::disconnectDevice() // Disconnect bus signals/slots disconnect(driver(), &IO::HAL_Driver::dataReceived, &m_frameReader, &FrameReader::processData); - disconnect(driver(), &IO::HAL_Driver::payloadReceived, this, - &IO::Manager::processPayload); // Close driver device driver()->close(); diff --git a/app/src/JSON/FrameParser.cpp b/app/src/JSON/FrameParser.cpp index 770b7692..f6f9c79d 100644 --- a/app/src/JSON/FrameParser.cpp +++ b/app/src/JSON/FrameParser.cpp @@ -366,7 +366,7 @@ void JSON::FrameParser::paste() */ void JSON::FrameParser::apply() { - (void) save(false); + (void)save(false); } /** @@ -387,7 +387,7 @@ void JSON::FrameParser::reload() // Load default template m_textEdit.setPlainText(defaultCode()); - (void) save(true); + (void)save(true); } /** @@ -419,7 +419,7 @@ void JSON::FrameParser::import() { auto data = file.readAll(); m_textEdit.setPlainText(QString::fromUtf8(data)); - (void) save(true); + (void)save(true); } } }