CEBL
2.1
Main Page
Namespaces
Data Structures
Files
File List
Globals
model
Mindset24.hpp
Go to the documentation of this file.
1
/*
2
* CEBL : CSU EEG Brain-Computer Interface Lab
3
*
4
* Author: Jeshua Bratman - jeshuabratman@gmail.com
5
*
6
* This file is part of CEBL.
7
*
8
* CEBL is free software; you can redistribute it and/or modify it.
9
* We only ask that if you use our code that you cite the source in
10
* your project or publication.
11
*
12
* EEG Group (www.cs.colostate.edu/eeg)
13
* Department of Computer Science
14
* Colorado State University
15
*
16
*/
17
25
#ifndef MINDSET24_H
26
#define MINDSET24_H
27
28
29
#include <sys/ioctl.h>
30
#include <fcntl.h>
31
#include <scsi/sg.h>
32
#include <boost/numeric/ublas/matrix.hpp>
33
#include <boost/numeric/ublas/vector.hpp>
34
#include <string>
35
using
std::string;
36
37
namespace
ublas = boost::numeric::ublas;
38
39
class
EEGData
;
40
41
#define SENSE_BUF_LEN 32
42
#define REPLY_STRING_LENGTH 32
43
#define REPLY_STRING_MAX 4096
44
46
enum
BlockSize
{
47
BLOCKSIZE96
=1,
48
BLOCKSIZE192
=2,
49
BLOCKSIZE384
=4,
50
BLOCKSIZE768
=8
51
};
52
54
enum
SampleRate
{
55
SAMPLERATE0
=0,
56
SAMPLERATE1024
=1,
57
SAMPLERATE512
=2,
58
SAMPLERATE256
=3,
59
SAMPLERATE128
=4,
60
SAMPLERATE64
=5
61
};
62
64
enum
MindsetCommand
{
65
INQUIRE
,
66
READDATA
,
67
READSTATUS
,
68
READY
,
69
SETSAMPLERATE
,
70
SETBLOCKSIZE
71
};
72
74
struct
MindsetReply
75
{
76
unsigned
char
*
reply
;
77
unsigned
char
*
sense_buffer
;
78
sg_io_hdr_t
io_hdr
;
79
bool
error
;
80
int
reply_len
;
81
int
sense_buffer_len
;
82
};
83
85
struct
MindsetStatus
86
{
87
SampleRate
sample_rate
;
88
BlockSize
block_size
;
89
int
num_data_bytes
;
90
};
91
92
94
class
Mindset24
95
{
96
97
private
:
98
MindsetReply
SendCommand(
MindsetCommand
command,
int
value = 0,
int
bytes =
REPLY_STRING_LENGTH
);
99
100
ublas::matrix<double> CreateEEGMatrix(
const
MindsetReply
&);
101
int
ActualBlockSize(
BlockSize
b);
102
void
CheckInquiry();
103
//private members
104
bool
is_open;
105
bool
is_mindset;
106
int
mindset_fp;
107
char
filename[255];
108
bool
debug;
109
110
111
public
:
112
113
Mindset24
();
114
void
Init
();
115
~Mindset24
();
116
117
//mindset functions
118
bool
Open
(
const
char
* filename);
119
void
Close
();
120
bool
Ready
();
121
bool
IsOpen
() {
return
is_open; };
122
SampleRate
GetSampleRate
();
123
BlockSize
GetBlockSize
();
124
void
SetSampleRate
(
SampleRate
);
125
void
SetBlockSize
(
BlockSize
);
126
std::string
Inquiry
();
127
bool
IsMindset
() {
return
is_mindset; };
128
MindsetStatus
GetStatus
();
129
130
//data reading
131
EEGData
GetAllData
();
132
EEGData
GetNextDataBlock
();
133
};
134
135
#endif
Generated by
1.8.1.1