-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathbiosemi_io.h
78 lines (65 loc) · 2.34 KB
/
biosemi_io.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 BIOSEMI_IO_H
#define BIOSEMI_IO_H
#include <boost/cstdint.hpp>
#include <vector>
#include <string>
#ifdef _WIN32
#define BIOSEMI_LINKAGE __cdecl
#else
#define BIOSEMI_LINKAGE
#endif
class biosemi_io {
public:
// raw sample from the BioSemi amp
typedef std::vector<boost::int32_t> sample_t;
// chunk of raw samples
typedef std::vector<sample_t> chunk_t;
// initialize amplifier connection
biosemi_io();
// shut down amplifier connection
~biosemi_io();
// get a chunk of raw data
void get_chunk(chunk_t &result);
// get channel names
const std::vector<std::string> &channel_labels() const { return channel_labels_; }
// get channel types (Sync, Trigger, EEG, EXG,
const std::vector<std::string> &channel_types() const { return channel_types_; }
// query amplifier parameters
bool is_mk2() const { return is_mk2_; }
bool battery_low() const { return battery_low_; }
int speed_mode() const { return speed_mode_; }
int srate() const { return srate_; }
int nbchan() const { return nbchan_; }
int nbsync() const { return nbsync_; }
int nbtrig() const { return nbtrig_; }
int nbeeg() const { return nbeeg_; }
int nbexg() const { return nbexg_; }
int nbaux() const { return nbaux_; }
int nbaib() const { return nbaib_; }
private:
static std::string get_last_error();
// amplifier parameters
bool is_mk2_; // whether the amp is a MK2 amplifier
int speed_mode_; // amplifier speed mode
int srate_; // native sampling rate
int nbsync_; // number of synchronization channels
int nbtrig_; // number of trigger channels
int nbeeg_; // number of EEG channels
int nbexg_; // number of ExG channels
int nbaux_; // number of AUX channels
int nbaib_; // number of AIB channels
int nbchan_; // total number of channels
bool battery_low_; // whether the battery is low
// vector of channel labels (in BioSemi naming scheme)
std::vector<std::string> channel_labels_;
// vector of channel types (in LSL Semi naming scheme)
std::vector<std::string> channel_types_;
// ring buffer pointer (from the driver)
boost::uint32_t *ring_buffer_;
int last_idx_;
// DLL handle
void *hDLL_;
// connection handle
void *hConn_;
};
#endif // BIOSEMI_IO_H