-
Notifications
You must be signed in to change notification settings - Fork 0
/
mainwindow.h
78 lines (69 loc) · 1.75 KB
/
mainwindow.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
72
73
74
75
76
77
78
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
#include <QWidget>
#include <QtSerialPort/QSerialPort>
#include <QtSerialPort/QSerialPortInfo>
#include <QtGui/QTextCursor>
#include <QTimer>
#include <QTextCodec>
#include <QEvent>
namespace Ui {
class MainWindow;
}
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
explicit MainWindow(QWidget *parent = nullptr);
~MainWindow();
QByteArray consoleTextBuffer;
QStringList history;
int historyPointer;
bool consoleTextBufferUpdated;
bool eventFilter(QObject* obj, QEvent *event);
struct SerialSettings {
QString name;
qint32 baudRate;
QString stringBaudRate;
QSerialPort::DataBits dataBits;
QString stringDataBits;
QSerialPort::Parity parity;
QString stringParity;
QSerialPort::StopBits stopBits;
QString stringStopBits;
QSerialPort::FlowControl flowControl;
QString stringFlowControl;
bool localEchoEnabled;
} currentSettings;
public slots:
void receive();
void send();
void receiveToHEX();
void receiveToDEC();
void receiveToBIN();
void textAreaUpdate();
void textAreasClear();
void setConsoleTextUpdate();
void callEnumeratePorts();
signals:
void keypress(int);
private:
Ui::MainWindow *ui;
QSerialPort *serial;
QTimer portPoller;
void openSerialPort();
void closeSerialPort();
void enumeratePorts();
void generateSettingsParameters();
void connectUiActions();
void updateSettings();
void send(const QByteArray &data);
private slots:
void togglePortConnection();
void about();
void sendString();
void pollPorts();
void keyeventHandler(int key);
};
#endif // MAINWINDOW_H