forked from brunoherbelin/App-SerialPortLinux
-
Notifications
You must be signed in to change notification settings - Fork 0
/
mainwindow.h
62 lines (47 loc) · 1.45 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
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
#include <QCloseEvent>
#include <QFileDialog>
#include <QMessageBox>
#include <string>
#include <vector>
#include <atomic>
#include <memory>
#include <thread>
// LSL API
#include <lsl_cpp.h>
//#define WIN32_LEAN_AND_MEAN
//#include "windows.h"
namespace Ui {
class MainWindow;
}
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
explicit MainWindow(QWidget *parent, const std::string &config_file);
~MainWindow();
private slots:
// config file dialog ops (from main menu)
void load_config_dialog();
void save_config_dialog();
// start the cognionics connection
void on_link();
// close event (potentially disabled)
void closeEvent(QCloseEvent *ev);
signals:
void error();
private:
// background data reader thread
void read_thread(const std::string &comPort, unsigned int baudRate, unsigned int dataBits, int parity, int stopbits, int readmode,
int samplingRate, int chunkSize, const std::string &streamName);
// raw config file IO
std::string _filename;
void load_config(const std::string &filename);
void save_config(const std::string &filename);
std::unique_ptr<std::thread> reader_thread_{nullptr}; // our reader thread
std::atomic<bool> shutdown_{false}; // flag indicating whether the streaming thread should quit
Ui::MainWindow *ui;
};
#endif // MAINWINDOW_H