forked from straend/SpherebotGUI
-
Notifications
You must be signed in to change notification settings - Fork 0
/
spherebot.h
55 lines (44 loc) · 1.09 KB
/
spherebot.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
#ifndef SPHEREBOT_H
#define SPHEREBOT_H
#include <QObject>
#include <QtSerialPort/QSerialPort>
#include <QtSerialPort/QSerialPortInfo>
#include <QFile>
#include <QTextStream>
#include <QTimer>
#include <QStringList>
#include <QDebug>
namespace Spherebot {
enum Printstate{SB_Disconnected, SB_Connected, SB_Printing, SB_Idle, SB_WaitUserOk, SB_WaitPrinterOk};
}
class SphereBot : public QObject
{
Q_OBJECT
public:
explicit SphereBot(QObject *parent = 0);
bool connectSerial(QString port);
void disconnectSerial();
void disableSteppers();
void sendFile(QString path);
void cancelPrint();
Spherebot::Printstate state;
public slots:
void continuePrinting();
void setServo(int value);
void setPitch(int value);
void setRoll(int value);
private slots:
void gotOkFromPrinter();
void readData();
private:
void sendCommand(QString cmd);
void sendNextLine();
QSerialPort *serial;
QString buffer;
QFile *file;
QTextStream *fileStream;
signals:
void printPause(QString message);
void printDone();
};
#endif // SPHEREBOT_H