AtCore  1.0.72
AtCore is a API to manage the serial connection between the computer and 3D Printers.
seriallayer.h
Go to the documentation of this file.
1 /* AtCore KDE Libary for 3D Printers
2  SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
3  SPDX-FileCopyrightText: 2016 Patrick José Pereira <patrickjp@kde.org>
4  SPDX-FileCopyrightText: 2016-2018, 2020 Chris Rizzitello <rizzitello@kde.org>
5  SPDX-FileCopyrightText: 2016, 2018 Tomaz Canabrava <tcanabrava@kde.org>
6  SPDX-FileCopyrightText: 2018 Leandro Santiago <leandrosansilva@gmail.com>
7 */
8 
9 #pragma once
10 
11 #include <QSerialPort>
12 
13 #include "atcore_export.h"
14 
19 class ATCORE_EXPORT SerialLayer : public QSerialPort
20 {
21  Q_OBJECT
22 
23 private:
26 
31  void readAllData();
32 signals:
33 
39  void pushedCommand(const QByteArray &comm);
40 
46  void receivedCommand(const QByteArray &comm);
47 
52  void serialError(QSerialPort::SerialPortError error);
53 
54 public:
62  SerialLayer(const QString &port, int32_t baud, QObject *parent = nullptr);
63 
70  void add(const QByteArray &comm, const QByteArray &term);
71 
77  void add(const QByteArray &comm);
78 
83  void handleError(QSerialPort::SerialPortError error);
84 
91  void pushCommand(const QByteArray &comm, const QByteArray &term);
92 
98  void pushCommand(const QByteArray &comm);
99 
104  void push();
105 
111  bool commandAvailable() const;
112 
118  QStringList validBaudRates() const;
119 };
SerialLayer::SerialLayerPrivate
The SerialLayerPrivate class.
Definition: seriallayer.cpp:18
SerialLayer::d
SerialLayerPrivate * d
Definition: seriallayer.h:24
SerialLayer
The SerialLayer class. Provide the low level serial operations.
Definition: seriallayer.h:19