AtCore  1.0.70
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
2  Copyright (C) <2016 - 2018>
3 
4  Authors:
5  Patrick José Pereira <patrickjp@kde.org>
6  Chris Rizzitello <rizzitello@kde.org>
7  Tomaz Canabrava <tcanabrava@kde.org>
8 
9  This library is free software; you can redistribute it and/or
10  modify it under the terms of the GNU Lesser General Public
11  License as published by the Free Software Foundation; either
12  version 2.1 of the License, or (at your option) version 3, or any
13  later version accepted by the membership of KDE e.V. (or its
14  successor approved by the membership of KDE e.V.), which shall
15  act as a proxy defined in Section 6 of version 3 of the license.
16 
17  This library is distributed in the hope that it will be useful,
18  but WITHOUT ANY WARRANTY; without even the implied warranty of
19  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20  Lesser General Public License for more details.
21 
22  You should have received a copy of the GNU Lesser General Public
23  License along with this library. If not, see <http://www.gnu.org/licenses/>.
24 */
25 #pragma once
26 
27 #include <QSerialPort>
28 
29 #include "atcore_export.h"
30 
35 class ATCORE_EXPORT SerialLayer : public QSerialPort
36 {
37  Q_OBJECT
38 
39 private:
42 
47  void readAllData();
48 signals:
49 
55  void pushedCommand(const QByteArray &comm);
56 
62  void receivedCommand(const QByteArray &comm);
63 
68  void serialError(QSerialPort::SerialPortError error);
69 
70 public:
78  SerialLayer(const QString &port, int32_t baud, QObject *parent = nullptr);
79 
86  void add(const QByteArray &comm, const QByteArray &term);
87 
93  void add(const QByteArray &comm);
94 
99  void handleError(QSerialPort::SerialPortError error);
100 
107  void pushCommand(const QByteArray &comm, const QByteArray &term);
108 
114  void pushCommand(const QByteArray &comm);
115 
120  void push();
121 
127  bool commandAvailable() const;
128 
134  QStringList validBaudRates() const;
135 };
The SerialLayerPrivate class.
Definition: seriallayer.cpp:35
The SerialLayer class. Provide the low level serial operations.
Definition: seriallayer.h:35
SerialLayerPrivate * d
Definition: seriallayer.h:40