CEBL  2.1
EEGDataStream.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 EEGDATASTREAM_H
26 #define EEGDATASTREAM_H
27 
28 #include "../CEBLIncludes.hpp"
29 #include "EEGData.hpp"
30 #include <boost/thread/thread.hpp>
31 #include <boost/thread/mutex.hpp>
32 #include "TimeoutThread.hpp"
33 
35 {
36 private:
37  void timeoutFunction();
38 
39 protected:
41  //samples per second
43  //updater
44  virtual void updater() = 0;
45  virtual void onStart() {};
46  virtual void onStop() {};
47 
48 public:
49  EEGDataStream();
50  virtual ~EEGDataStream();
51 
52  void start();
53  void stop();
54 
55  void setSampleRate(int sr) { sample_rate = sr; }
56 
57  bool isStarted() { return is_started; }
60  EEGData read(int samples);
62  EEGData readAll();
63 };
64 
65 
66 
67 #endif