CEBL  2.1
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 {
51 };
52 
54 enum SampleRate {
61 };
62 
71 };
72 
75 {
76  unsigned char *reply;
77  unsigned char *sense_buffer;
78  sg_io_hdr_t io_hdr;
79  bool error;
80  int reply_len;
82 };
83 
86 {
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; };
125  void SetBlockSize(BlockSize);
126  std::string Inquiry();
127  bool IsMindset() { return is_mindset; };
129 
130  //data reading
133 };
134 
135 #endif