AtCore 1.0.72
AtCore is a API to manage the serial connection between the computer and 3D Printers.
Loading...
Searching...
No Matches
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
19class ATCORE_EXPORT SerialLayer : public QSerialPort
20{
21 Q_OBJECT
22
23private:
24 struct SerialLayerPrivate;
26
31 void readAllData();
32signals:
33
39 void pushedCommand(const QByteArray &comm);
40
46 void receivedCommand(const QByteArray &comm);
47
52 void serialError(QSerialPort::SerialPortError error);
53
54public:
62 SerialLayer(const QString &port, int32_t baud, QObject *parent = nullptr);
64
71 void add(const QByteArray &comm, const QByteArray &term);
72
78 void add(const QByteArray &comm);
79
84 void handleError(QSerialPort::SerialPortError error);
85
92 void pushCommand(const QByteArray &comm, const QByteArray &term);
93
99 void pushCommand(const QByteArray &comm);
100
105 void push();
106
112 bool commandAvailable() const;
113
119 QStringList validBaudRates() const;
120};
The SerialLayer class. Provide the low level serial operations.
Definition seriallayer.h:20
void serialError(QSerialPort::SerialPortError error)
Emit a signal if an error has happened.
SerialLayerPrivate * d
Definition seriallayer.h:25
void receivedCommand(const QByteArray &comm)
Emit signal when command is received.
void pushedCommand(const QByteArray &comm)
Emit signal when command is pushed.
The SerialLayerPrivate class.
Definition seriallayer.cpp:18