MNE-CPP  beta 1.0
fiffsimulator.h
1 //=============================================================================================================
36 #ifndef FIFFSIMULATOR_H
37 #define FIFFSIMULATOR_H
38 
39 
40 //*************************************************************************************************************
41 //=============================================================================================================
42 // INCLUDES
43 //=============================================================================================================
44 
45 #include "fiffsimulator_global.h"
46 
51 
52 
53 //*************************************************************************************************************
54 //=============================================================================================================
55 // FIFF INCLUDES
56 //=============================================================================================================
57 
58 #include <fiff/fiff_info.h>
59 
60 
61 //*************************************************************************************************************
62 //=============================================================================================================
63 // MNE INCLUDES
64 //=============================================================================================================
65 
66 #include <rtClient/rtcmdclient.h>
67 
68 
69 //*************************************************************************************************************
70 //=============================================================================================================
71 // QT INCLUDES
72 //=============================================================================================================
73 
74 #include <QtWidgets>
75 #include <QVector>
76 #include <QTimer>
77 
78 
79 //*************************************************************************************************************
80 //=============================================================================================================
81 // DEFINE NAMESPACE FiffSimulatorPlugin
82 //=============================================================================================================
83 
84 namespace FiffSimulatorPlugin
85 {
86 
87 
88 //*************************************************************************************************************
89 //=============================================================================================================
90 // USED NAMESPACES
91 //=============================================================================================================
92 
93 using namespace MNEX;
94 using namespace IOBuffer;
95 using namespace RTCLIENTLIB;
96 using namespace FIFFLIB;
97 using namespace XMEASLIB;
98 
99 
100 //*************************************************************************************************************
101 //=============================================================================================================
102 // FORWARD DECLARATIONS
103 //=============================================================================================================
104 
105 class FiffSimulatorProducer;
106 
107 
108 //=============================================================================================================
114 class FIFFSIMULATORSHARED_EXPORT FiffSimulator : public ISensor
115 {
116  Q_OBJECT
117  Q_PLUGIN_METADATA(IID "mne_x/1.0" FILE "fiffsimulator.json") //NEw Qt5 Plugin system replaces Q_EXPORT_PLUGIN2 macro
118  // Use the Q_INTERFACES() macro to tell Qt's meta-object system about the interfaces
119  Q_INTERFACES(MNEX::ISensor)
120 
121  friend class FiffSimulatorProducer;
122  friend class FiffSimulatorSetupWidget;
123 
124 public:
125 
126  //=========================================================================================================
130  FiffSimulator();
131 
132  //=========================================================================================================
136  virtual ~FiffSimulator();
137 
138  //=========================================================================================================
142  void clear();
143 
144  //=========================================================================================================
148  virtual QSharedPointer<IPlugin> clone() const;
149 
150  //=========================================================================================================
154  virtual void init();
155 
156  //=========================================================================================================
160  virtual void unload();
161 
162  virtual bool start();
163  virtual bool stop();
164 
165  virtual IPlugin::PluginType getType() const;
166  virtual QString getName() const;
167 
168  virtual QWidget* setupWidget();
169 
170 //slots:
171  //=========================================================================================================
177  void changeConnector(qint32 p_iNewConnectorId);
178 
179  //=========================================================================================================
183  void connectCmdClient();
184 
185  //=========================================================================================================
189  void disconnectCmdClient();
190 
191  //=========================================================================================================
195  void requestInfo();
196 
197 signals:
198  //=========================================================================================================
204  void cmdConnectionChanged(bool p_bStatus);
205 
206  //=========================================================================================================
210  void fiffInfoAvailable();
211 
212 protected:
213  virtual void run();
214 
215 private:
216  //=========================================================================================================
220  void initConnector();
221 
222 
223  QMutex m_qMutex;
224 
225 
226  QString m_sFiffSimulatorClientAlias;
228 // float m_fSamplingRate; /**< The sampling rate.*/
229 // int m_iDownsamplingFactor; /**< The down sampling factor.*/
230 
231  PluginOutputData<NewRealTimeMultiSampleArray>::SPtr m_pRTMSA_FiffSimulator;
233  QSharedPointer<RtCmdClient> m_pRtCmdClient;
234  bool m_bCmdClientIsConnected;
236  QString m_sFiffSimulatorIP;
237  QSharedPointer<FiffSimulatorProducer> m_pFiffSimulatorProducer;
240  QMap<qint32, QString> m_qMapConnectors;
241  qint32 m_iActiveConnectorId;
244  FiffInfo::SPtr m_pFiffInfo;
245  qint32 m_iBufferSize;
247  QTimer m_cmdConnectionTimer;
249  QSharedPointer<RawMatrixBuffer> m_pRawMatrixBuffer_In;
251  bool m_bIsRunning;
253 };
254 
255 } // NAMESPACE
256 
257 #endif // FIFFSIMULATOR_H
FIFF measurement file information.
Definition: fiff_info.h:96
Real-time command client.
Definition: rtcmdclient.h:86
CircularMatrixBuffer class declaration.
The IPlugin class is the base interface class of all plugins.
Definition: IPlugin.h:92
The ISensor class provides an interface for a sensor plugin.
Definition: ISensor.h:63
FiffInfo class declaration.
Contains the declaration of the CircularBuffer_old class.
Definition: arrow.h:75
PluginOutputConnector with specified Measurement.
Definition: fiff.h:98
Contains the declaration of the NewRealTimeMultiSampleArray class.
declaration of the RtCmdClient Class.
Contains declaration of IIinverseAlgorithm interface class.
The RealTimeMultiSampleArrayNew class is the base class of every RealTimeMultiSampleArrayNew Measurem...