-
Notifications
You must be signed in to change notification settings - Fork 3
/
mainwindow.h
117 lines (90 loc) · 2.63 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
102
103
104
105
106
107
108
109
110
111
112
113
114
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
#include "ui_mainwindow.h"
#include <QThread>
#include <QCloseEvent>
#include <QFileDialog>
#include <QMessageBox>
#include <string>
#include <vector>
// LSL API
#include <LSL/lsl_cpp.h>
// eegoSports
#define WIN32_LEAN_AND_MEAN
#define EEGO_SDK_BIND_STATIC
#ifdef _WIN32
#include <Windows.h>
#endif
#include "eemagine/sdk/factory.h"
// --------------------------------------------------------------------------------
// Reader class
// --------------------------------------------------------------------------------
class Reader : public QObject {
Q_OBJECT
public:
Reader();
~Reader();
public slots:
void read();
void setStop(bool stop) {
this->stop = stop;
}
void setParams(int capId, int samplingRate, double BipRange, double EegRange, unsigned long long hexEegMask, unsigned long long hexBipMask);
private:
void OpenEegStream();
signals:
void finished();
void timeout();
void ampNotFound();
void connectionLost();
void unknownError();
private:
// SDK classes
eemagine::sdk::factory fact;
eemagine::sdk::amplifier* amp;
eemagine::sdk::stream* eegStream;
eemagine::sdk::buffer buffer;
// amplifier parameters
int samplingRate;
double EegRange;
double BipRange;
unsigned long long hexEegMask;
unsigned long long hexBipMask;
// Cap layout
std::vector<std::string> capLayout;
// Stop acquisition if set to false.
bool stop;
};
// --------------------------------------------------------------------------------
// MainWindow Class
// --------------------------------------------------------------------------------
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
explicit MainWindow(QWidget *parent, const std::string &config_file, const bool linkOnStart);
~MainWindow();
private slots:
void threadFinished();
void threadTimeout();
void connectionLost();
void ampNotFound();
void unknownError();
void load_config_dialog();
void save_config_dialog();
// start the eegosports connection
void link();
// close event (potentially disabled)
void closeEvent(QCloseEvent *ev);
private:
// background data reader thread
void read_thread(std::string deviceNumber, int chunkSize, int samplingRate, bool isSlave, std::string serialNumber, int channelCount, std::vector<std::string> channelLabels);
// raw config file IO
void load_config(const std::string &filename);
void save_config(const std::string &filename);
Reader *reader;
QThread *thread;
Ui::MainWindowClass ui;
};
#endif // MAINWINDOW_H