-
Notifications
You must be signed in to change notification settings - Fork 24
/
Copy pathsender.h
71 lines (59 loc) · 1.45 KB
/
sender.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#ifndef SENDER_H
#define SENDER_H
#include <QObject>
#include <QSerialPort>
#include <QSerialPortInfo>
#include <QQueue>
#include <QTimer>
#include <QSettings>
#include <QVector>
#include "repraptor.h"
using namespace RepRaptor;
class Sender : public QObject
{
Q_OBJECT
public:
explicit Sender(QObject *parent = 0);
~Sender();
protected:
QSerialPort *printer;
QTimer *sendTimer;
long int currentLine;
long int totalLineNum;
long int resendNum;
long int baudrate;
long int flowcontrol;
bool paused;
bool sending;
bool dtr;
bool readyReceive;
bool sendingChecksum;
bool resending;
QQueue <QString> userCommands;
QStringList sentCommands;
QVector <QString> gcode;
bool sendLine(QString s);
signals:
void errorReceived(QSerialPort::SerialPortError error);
void dataReceived(QByteArray data);
void reportProgress(FileProgress p);
void baudrateSetFailed(int b);
public slots:
void openPort(QSerialPortInfo i);
void closePort();
void startPrinting();
void stopPrinting();
void pause(bool p);
void setBaudrate(int b);
void setFile(QVector <QString> f);
void injectCommand(QString);
void flushInjectionBuffer();
void receivedOkWait();
void receivedOkNum(int);
void receivedStart();
void receivedResend(int r);
void sendNext();
void receivedData();
void receivedError(QSerialPort::SerialPortError error);
};
#endif // SENDER_H