MNE-CPP  beta 1.0
triggercontrol.h
Go to the documentation of this file.
1 //=============================================================================================================
37 #ifndef TRIGGERCONTROL_H
38 #define TRIGGERCONTROL_H
39 
40 
41 //*************************************************************************************************************
42 //=============================================================================================================
43 // INCLUDES
44 //=============================================================================================================
45 
46 #include "triggercontrol_global.h"
47 
53 
54 
55 
56 //*************************************************************************************************************
57 //=============================================================================================================
58 // QT INCLUDES
59 //=============================================================================================================
60 
61 #include <QTime>
62 
63 
64 //*************************************************************************************************************
65 //=============================================================================================================
66 // DEFINE NAMESPACE TriggerControlPlugin
67 //=============================================================================================================
68 
69 namespace TriggerControlPlugin
70 {
71 
72 
73 //*************************************************************************************************************
74 //=============================================================================================================
75 // USED NAMESPACES
76 //=============================================================================================================
77 
78 using namespace MNEX;
79 using namespace XMEASLIB;
80 using namespace IOBuffer;
81 
82 
83 //*************************************************************************************************************
84 //=============================================================================================================
85 // FORWARD DECLARATIONS
86 //=============================================================================================================
87 
88 class SettingsWidget;
89 class SerialPort;
90 
91 
92 //=============================================================================================================
101 class TRIGGERCONTROLSHARED_EXPORT TriggerControl : public IAlgorithm
102 {
103  Q_OBJECT
104  Q_PLUGIN_METADATA(IID "mne_x/1.0" FILE "triggercontrol.json") //NEw Qt5 Plugin system replaces Q_EXPORT_PLUGIN2 macro
105  // Use the Q_INTERFACES() macro to tell Qt's meta-object system about the interfaces
106  Q_INTERFACES(MNEX::IAlgorithm)
107 
108  friend class TriggerControlSetupWidget;
109  friend class SettingsWidget;
110 
111 public:
112  //=========================================================================================================
116  TriggerControl();
117 
118  //=========================================================================================================
122  ~TriggerControl();
123 
124  //=========================================================================================================
128  virtual void init();
129 
130  //=========================================================================================================
134  virtual void unload();
135 
136  //=========================================================================================================
140  virtual QSharedPointer<IPlugin> clone() const;
141 
142  //=========================================================================================================
146  virtual bool start();
147 
148  //=========================================================================================================
152  virtual bool stop();
153 
154  //=========================================================================================================
158  virtual IPlugin::PluginType getType() const;
159 
160  //=========================================================================================================
164  virtual QString getName() const;
165 
166 
167  //=========================================================================================================
171  virtual QWidget* setupWidget();
172 
173  //=========================================================================================================
177  void updateSingleChannel(XMEASLIB::NewMeasurement::SPtr pMeasurement);
178 
179  //=========================================================================================================
183  void update(XMEASLIB::NewMeasurement::SPtr pMeasurement);
184 
185  //=========================================================================================================
189  void byteReceived();
190 
191 
192 
193 signals:
194 // void sendByte(int value);
195  void sendByte(int value, int channel);
196 
197 
198 protected:
199 
200  //=========================================================================================================
204  virtual void run();
205 
206  //=========================================================================================================
211  void sendByteTo(int value, int channel);
212 
213 
214 
215 private:
219 
220  QVector<int> m_vTimes;
221 
222  bool m_bBspBool;
223 
224  QSharedPointer<SerialPort> m_pSerialPort;
225 
226  qint32 m_iBaud;
227 
228  QMutex m_qMutex;
229 
230  CircularMatrixBuffer<double>::SPtr m_pDataMatrixBuffer;
232  QVector<VectorXd> m_pData;
233  dBuffer::SPtr m_pDataSingleChannel;
234 
235  qint32 m_iNumChs;
236 
237  QTime m_qTime;
238 
239  bool m_bIsRunning;
240  bool m_isReceived;
241 
242 
243 
244  //alpha locked stuff
245 
246  double m_fs;
247  double m_dt;
248  double m_refFreq;
249  double m_alphaFreq;
250 
251  VectorXd m_refSin;
252  VectorXd m_vecCorr;
253 
254  double corr(VectorXd a, VectorXd b);
255 
256 
257 };
258 
259 } // NAMESPACE
260 
261 #endif // TRIGGERCONTROL_H
Contains declaration of IAlgorithm interface class.
CircularMatrixBuffer class declaration.
The TriggerControl is a MNE-X plugin which contains an intuitive terminal for manual configurations o...
QSharedPointer< PluginOutputData< T > > SPtr
The circular matrix buffer.
The IAlgorithm class provides an interface for a real-time algorithm plugin.
Definition: IAlgorithm.h:70
Contains the declaration of the NewRealTimeSampleArray class.
QSharedPointer< PluginInputData > SPtr
The TriggerControlSetupWidget class provides the TriggerControlToolbox configuration window...
Definition: arrow.h:75
CircularBuffer class declaration.
The TriggerControlSetupWidget class provides the TriggerControlToolbox configuration window...
QSharedPointer< NewMeasurement > SPtr
Contains the declaration of the NewRealTimeMultiSampleArray class.