MNE-CPP  beta 1.0
fiffsimulator.h
1 //=============================================================================================================
36 #ifndef FIFFSIMULATOR_H
37 #define FIFFSIMULATOR_H
38 
39 //*************************************************************************************************************
40 //=============================================================================================================
41 // INCLUDES
42 //=============================================================================================================
43 
44 #include "fiffsimulator_global.h"
45 #include "../../mne_rt_server/IConnector.h"
46 
47 
48 //*************************************************************************************************************
49 //=============================================================================================================
50 // MNE INCLUDES
51 //=============================================================================================================
52 
53 #include <fiff/fiff_raw_data.h>
55 
56 
57 //*************************************************************************************************************
58 //=============================================================================================================
59 // QT INCLUDES
60 //=============================================================================================================
61 
62 #include <QString>
63 #include <QMutex>
64 
65 
66 //*************************************************************************************************************
67 //=============================================================================================================
68 // DEFINE NAMESPACE FiffConnectorPlugin
69 //=============================================================================================================
70 
71 namespace FiffSimulatorPlugin
72 {
73 
74 
75 //*************************************************************************************************************
76 //=============================================================================================================
77 // USED NAMESPACES
78 //=============================================================================================================
79 
80 using namespace RTSERVER;
81 using namespace IOBuffer;
82 
83 //*************************************************************************************************************
84 //=============================================================================================================
85 // FORWARD DECLARATIONS
86 //=============================================================================================================
87 
88 class FiffProducer;
89 
90 
91 //=============================================================================================================
97 class FIFFSIMULATORSHARED_EXPORT FiffSimulator : public IConnector
98 {
99  Q_OBJECT
100  Q_PLUGIN_METADATA(IID "mne_rt_server/1.0" FILE "fiffsimulator.json") //NEw Qt5 Plugin system replaces Q_EXPORT_PLUGIN2 macro
101  // Use the Q_INTERFACES() macro to tell Qt's meta-object system about the interfaces
102  Q_INTERFACES(RTSERVER::IConnector)
103 
104 
105  friend class FiffProducer;
106 
107 public:
108  struct Commands
109  {
110  static const QString BUFSIZE;
111  static const QString GETBUFSIZE;
112  static const QString ACCEL;
113  static const QString GETACCEL;
114  static const QString SIMFILE;
115  };
116 
117  //=========================================================================================================
121  FiffSimulator();
122 
123  //=========================================================================================================
127  virtual ~FiffSimulator();
128 
129  virtual void connectCommandManager();
130 
131  virtual ConnectorID getConnectorID() const;
132 
133  virtual const char* getName() const;
134 
135  virtual void info(qint32 ID);
136 
137  virtual bool start();
138 
139  virtual bool stop();
140 
141 protected:
142  virtual void run();
143 
144 private:
145 
146  //Slots
147  //=========================================================================================================
153  void comBufsize(Command p_command);
154 
155  //=========================================================================================================
161  void comGetBufsize(Command p_command);
162 
163  //=========================================================================================================
169  void comAccel(Command p_command);
170 
171  //=========================================================================================================
177  void comGetAccel(Command p_command);
178 
179  //=========================================================================================================
185  void comSimfile(Command p_command);
186 
188 
189  //=========================================================================================================
193  void init();
194 
195  bool readRawInfo();
196 
197  QMutex mutex;
198 
199  FiffProducer* m_pFiffProducer;
200  FiffRawData m_RawInfo;
201  QString m_sResourceDataPath;
202  quint32 m_uiBufferSampleSize;
203  float m_AccelerationFactor;
204  float m_TrueSamplingRate;
206  RawMatrixBuffer* m_pRawMatrixBuffer;
208  bool m_bIsRunning;
209 };
210 
211 } // NAMESPACE
212 
213 #endif // FIFFSIMULATOR_H
CircularMatrixBuffer class declaration.
The IConnector class is the interface class of all plugins.
Definition: IConnector.h:119
FIFF raw measurement data.
Definition: fiff_raw_data.h:94
The FiffProducer class provides a ECG data producer for a given sampling rate.
Definition: fiffproducer.h:87
FiffRawData class declaration.
The FiffSimulator class provides a Fiff data simulator.
Definition: fiffsimulator.h:97