-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmainwindow.h
More file actions
72 lines (54 loc) · 1.4 KB
/
mainwindow.h
File metadata and controls
72 lines (54 loc) · 1.4 KB
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
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
#include <QSerialPort>
#include <QSerialPortInfo>
#include <QtNetwork>
#include <QTimer>
namespace Ui {
class MainWindow;
}
template<class T> bool
my_connect(const QSharedPointer<T> &sender,
const char *signal,
const QObject *receiver,
const char *method,
Qt::ConnectionType type = Qt::AutoConnection)
{
return QObject::connect(sender.data(), signal, receiver, method, type);
}
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
explicit MainWindow(QWidget *parent = 0);
~MainWindow();
public slots:
void DetectPorts();
void StartRead();
void onSerialRead();
void SendToHttpURL();
void Log(QString str);
void replyFinished(QNetworkReply *reply);
void changeTimerVal(int val);
void onTimer();
void SaveSettingsAndDisableUI();
void LoadSettingsAndEnableUI();
void LogToFile();
signals:
void PacketReceived();
private:
Ui::MainWindow *ui;
QList<QSerialPortInfo> _portList;
QSharedPointer<QSerialPort> _ptrPort;
bool _bEnabled;
int _iFSMState; //FSM state
float _vals[100];
int _iNval;
int _iCurVal;
QByteArray _buffer;
QTimer _timerC2A;
QNetworkAccessManager _qnam;
QSettings *_psettings;
};
#endif // MAINWINDOW_H