MNE-CPP  beta 1.0
eegosportsdriver.h
Go to the documentation of this file.
1 //=============================================================================================================
37 #ifndef EEGOSPORTSDRIVER_H
38 #define EEGOSPORTSDRIVER_H
39 
40 
41 //*************************************************************************************************************
42 //=============================================================================================================
43 // INCLUDES
44 //=============================================================================================================
45 
46 #include <iostream>
47 #include <fstream>
48 #include <cmath>
49 #include <cstring>
50 #include <vector>
51 #include <map>
52 #include <tchar.h>
53 #include <string.h>
54 #include <windows.h>
55 #include <Eigen/Core>
56 
57 #include <eego.h>
58 
59 
60 //*************************************************************************************************************
61 //=============================================================================================================
62 // QT STL INCLUDES
63 //=============================================================================================================
64 
65 #include <QSharedPointer>
66 #include <qapplication.h>
67 #include <QVector>
68 #include <QSysInfo>
69 
70 
71 //*************************************************************************************************************
72 //=============================================================================================================
73 // DEFINE NAMESPACE TMSIPlugin
74 //=============================================================================================================
75 
76 namespace EEGoSportsPlugin
77 {
78 
79 
80 //*************************************************************************************************************
81 //=============================================================================================================
82 // Method Typedefs - method defines as used in the RTINST.DLL
83 //=============================================================================================================
84 
85 // define a pointer CREATEAMPLIFIER to a function which is taking a void HANDLE and returns a HRESULT value
86 typedef HRESULT (* CREATEAMPLIFIER) (IAmplifier** ppObject);
87 
88 
89 //*************************************************************************************************************
90 //=============================================================================================================
91 // USED NAMESPACES
92 //=============================================================================================================
93 
94 using namespace std;
95 using namespace Eigen;
96 
97 
98 //*************************************************************************************************************
99 //=============================================================================================================
100 // FORWARD DECLARATIONS
101 //=============================================================================================================
102 
103 class EEGoSportsProducer;
104 
105 
106 //*************************************************************************************************************
107 //=============================================================================================================
108 // DEFINES
109 //=============================================================================================================
110 
111 #define MAX_BUFFER_SIZE 0xFFFFFFFF
112 
113 //DLL Function loader define
114 #define __load_dll_func__(var, type, name) \
115  var = (type)::GetProcAddress(m_oLibHandle, name); \
116  if(!var) \
117  cout<< "Plugin EEGoSports - ERROR - Error loading method " << name << "\n"; \
118 
119 
120 //=============================================================================================================
127 {
128 public:
129  //=========================================================================================================
135  EEGoSportsDriver(EEGoSportsProducer* pEEGoSportsProducer);
136 
137  //=========================================================================================================
141  ~EEGoSportsDriver();
142 
143  //=========================================================================================================
149  bool getSampleMatrixValue(MatrixXf& sampleMatrix);
150 
151  //=========================================================================================================
162  bool initDevice(int iNumberOfChannels,
163  int iSamplingFrequency,
164  bool bUseChExponent,
165  bool bWriteDriverDebugToFile,
166  QString sOutpuFilePath,
167  bool bMeasureImpedance);
168 
169  //=========================================================================================================
174  bool uninitDevice();
175 
176 private:
177  EEGoSportsProducer* m_pEEGoSportsProducer;
179  //Flags
180  bool m_bInitDeviceSuccess;
181  bool m_bDllLoaded;
183  //User definitons
184  uint m_uiNumberOfChannels;
185  uint m_uiSamplingFrequency;
186  bool m_bUseChExponent;
187  bool m_bWriteDriverDebugToFile;
188  bool m_bUsePreprocessing;
189  QString m_sOutputFilePath;
190  bool m_bMeasureImpedances;
192  //Handler
193  HINSTANCE m_oLibHandle;
195  //Device info
196  ULONG m_uiNumberOfAvailableChannels;
198  //Signal info
199  ofstream m_outputFileStream;
200  IAmplifier* m_pAmplifier;
201  uint m_nLastTriggerValue;
203  //Variables used for loading the TMSiSDK.dll methods. Note: Not all functions are used by this class at the moment.
204  CREATEAMPLIFIER m_oFpCreateAmplifier;
205 
206  //=========================================================================================================
211  EEGoSportsPlugin::EEGO_GAIN GetGainForSignalRange(int range);
212 };
213 
214 } // NAMESPACE
215 
216 #endif // EEGOSPORTSDRIVER_H
The EEGoSportsDriver class provides real time data acquisition of EEG data with a TMSi Refa device...
The EEGProducer class provides a EEG data producer for a given sampling rate.