-
Notifications
You must be signed in to change notification settings - Fork 0
/
mainwindow.h
101 lines (81 loc) · 2.36 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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
#include "serialconfig.h"
#include "addsequence.h"
#include <qlistwidget.h>
#include "serialseq.h"
#include <QSerialPort>
#include <QByteArray>
#include <QFile>
#define TEXT_BROWSER_MARGIN_IN_PX 20
#define TEXT_BROWSER_MOUSE_HOVER_THR 100
#define MAX_VISIBLE_SEQ_NAME_LEN 3
#define MAX_VISIBLE_SEQ_DATA_LEN 4
#define MAX_VISIBLE_SEQ_PER_LEN 4
enum portStatus
{
OPENED = 0,
CLOSED = 1,
};
enum textBrowserStatus
{
ASCII = 0,
HEX = 1,
};
struct serialportConf
{
QString name;
int parity;
int baud;
int data;
int stop;
int flowControl;
int status;
};
namespace Ui {
class MainWindow;
}
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
explicit MainWindow(QWidget *parent = 0);
~MainWindow();
public slots:
void addAsciiSequence(const QString &, const QString &, int, int, int, int);
void addHexSequence(const QString &, const QString &, const QByteArray &, int, int, int, int);
void createNewSerialPort(const QString portName, int baudRate, int dataBits, int stopBits, int parity);
void writeToSerialPort(char *, int, const QString &);
void readData();
void finishCountProcess(int);
private slots:
void on_actionSerial_Port_triggered();
void on_actionQuit_triggered();
void on_actionStart_triggered();
void on_pushButton_clicked();
void on_serialSeqStartButton_clicked();
void on_actionStop_triggered();
void on_seq_edit_but_clicked();
void on_actionAbout_triggered();
void on_ascCheck_stateChanged(int arg1);
void on_hexCheck_stateChanged(int arg1);
void on_ckearTextBrw_clicked();
void on_saveBrwToFile_clicked();
private:
Ui::MainWindow *ui;
serialConfig *serialConf = NULL; // This will add new serial port (Dialog)
addSequence *newSerialSeq = NULL; // This will add new sequence (Dialog)
serialSeq serialseq; // This will keep all serial sequences in a list
QSerialPort *port = NULL; // This will keep serial port
int topLeftTxtBrowser_x;
int topLeftTxtBrowser_y;
int gridLayLastRow = 0;
struct serialportConf portConfig;
int browserStatus = ASCII;
int saveToFileFlag = 0; // Save to file flag
QString saveToFilePath;
QFile *file; // pointer to save file.
QTextStream *outStream; // Out stream to file
};
#endif // MAINWINDOW_H