54 #include <QtCore/QtPlugin>
55 #include <QtCore/QTextStream>
56 #include <QtCore/QFile>
76 : m_pRTSA_ECG_I_new(0)
77 , m_fSamplingRate(250.0)
78 , m_iDownsamplingFactor(1)
79 , m_pInBuffer_I(new dBuffer(1024))
80 , m_pInBuffer_II(new dBuffer(1024))
81 , m_pInBuffer_III(new dBuffer(1024))
82 , m_pECGProducer(new
ECGProducer(this, m_pInBuffer_I, m_pInBuffer_II, m_pInBuffer_III))
83 , m_qStringResourcePath(qApp->applicationDirPath()+
"/mne_x_plugins/resources/ECGSimulator/")
84 , m_pECGChannel_ECG_I(new
ECGSimChannel(m_qStringResourcePath+
"data/", QString(
"ECG_I_256_s30661.txt")))
85 , m_pECGChannel_ECG_II(new
ECGSimChannel(m_qStringResourcePath+
"data/", QString(
"ECG_II_256_s30661.txt")))
86 , m_pECGChannel_ECG_III(new
ECGSimChannel(m_qStringResourcePath+
"data/", QString(
"ECG_III_256_s30661.txt")))
106 QSharedPointer<ECGSimulator> pECGSimulatorClone(
new ECGSimulator());
107 return pECGSimulatorClone;
118 if(m_pECGChannel_ECG_I->isEnabled())
124 if(m_pECGChannel_ECG_II->isEnabled())
130 if(m_pECGChannel_ECG_III->isEnabled())
150 m_pECGChannel_ECG_I->initChannel();
151 m_pECGChannel_ECG_II->initChannel();
152 m_pECGChannel_ECG_III->initChannel();
154 if(m_pECGChannel_ECG_I->isEnabled())
156 double diff = m_pECGChannel_ECG_I->getMaximum() - m_pECGChannel_ECG_I->getMinimum();
158 m_pRTSA_ECG_I_new->data()->setName(
"ECG I");
159 m_pRTSA_ECG_I_new->data()->setUnit(
"mV");
161 m_pRTSA_ECG_I_new->data()->setMinValue(m_pECGChannel_ECG_I->getMinimum()-diff/10);
162 m_pRTSA_ECG_I_new->data()->setMaxValue(m_pECGChannel_ECG_I->getMaximum()+diff/10);
163 m_pRTSA_ECG_I_new->data()->setArraySize(10);
164 m_pRTSA_ECG_I_new->data()->setSamplingRate(m_fSamplingRate/m_iDownsamplingFactor);
165 m_pRTSA_ECG_I_new->data()->setVisibility(m_pECGChannel_ECG_I->isVisible());
168 if(m_pECGChannel_ECG_II->isEnabled())
170 double diff = m_pECGChannel_ECG_II->getMaximum() - m_pECGChannel_ECG_II->getMinimum();
172 m_pRTSA_ECG_II_new->data()->setName(
"ECG II");
173 m_pRTSA_ECG_II_new->data()->setUnit(
"mV");
175 m_pRTSA_ECG_II_new->data()->setMinValue(m_pECGChannel_ECG_II->getMinimum()-diff/10);
176 m_pRTSA_ECG_II_new->data()->setMaxValue(m_pECGChannel_ECG_II->getMaximum()+diff/10);
177 m_pRTSA_ECG_II_new->data()->setArraySize(10);
178 m_pRTSA_ECG_II_new->data()->setSamplingRate(m_fSamplingRate/m_iDownsamplingFactor);
179 m_pRTSA_ECG_II_new->data()->setVisibility(m_pECGChannel_ECG_II->isVisible());
182 if(m_pECGChannel_ECG_III->isEnabled())
184 double diff = m_pECGChannel_ECG_III->getMaximum() - m_pECGChannel_ECG_III->getMinimum();
186 m_pRTSA_ECG_III_new->data()->setName(
"ECG III");
187 m_pRTSA_ECG_III_new->data()->setUnit(
"mV");
189 m_pRTSA_ECG_III_new->data()->setMinValue(m_pECGChannel_ECG_III->getMinimum()-diff/10);
190 m_pRTSA_ECG_III_new->data()->setMaxValue(m_pECGChannel_ECG_III->getMaximum()+diff/10);
191 m_pRTSA_ECG_III_new->data()->setArraySize(10);
192 m_pRTSA_ECG_III_new->data()->setSamplingRate(m_fSamplingRate/m_iDownsamplingFactor);
193 m_pRTSA_ECG_III_new->data()->setVisibility(m_pECGChannel_ECG_III->isVisible());
203 if(this->isRunning())
209 m_pECGProducer->start();
211 if(m_pECGProducer->isRunning())
219 qWarning() <<
"Plugin TMSI - ERROR - TMSIProducer thread could not be started - Either the device is turned off (check your OS device manager) or the driver DLL (TMSiSDK.dll / TMSiSDK32bit.dll) is not installed in the system32 / SysWOW64 directory" << endl;
230 m_pECGProducer->stop();
233 m_bIsRunning =
false;
237 m_pInBuffer_I->releaseFromPop();
238 m_pInBuffer_I->clear();
239 m_pInBuffer_II->releaseFromPop();
240 m_pInBuffer_II->clear();
241 m_pInBuffer_III->releaseFromPop();
242 m_pInBuffer_III->clear();
246 m_pECGChannel_ECG_I->clear();
247 m_pECGChannel_ECG_II->clear();
248 m_pECGChannel_ECG_III->clear();
250 m_pInBuffer_I->clear();
251 m_pInBuffer_II->clear();
252 m_pInBuffer_III->clear();
270 return "ECG Simulator";
294 double dValue_II = 0;
295 double dValue_III = 0;
300 if(m_pECGProducer->isRunning())
302 if(m_pECGChannel_ECG_I->isEnabled())
304 dValue_I = m_pInBuffer_I->pop();
305 m_pRTSA_ECG_I_new->data()->setValue(dValue_I);
307 if(m_pECGChannel_ECG_II->isEnabled())
309 dValue_II = m_pInBuffer_II->pop();
310 m_pRTSA_ECG_II_new->data()->setValue(dValue_II);
312 if(m_pECGChannel_ECG_III->isEnabled())
314 dValue_III = m_pInBuffer_III->pop();
315 m_pRTSA_ECG_III_new->data()->setValue(dValue_III);
Contains the declaration of the ECGProducer class.
OutputConnectorList m_outputConnectors
The ECGChannel class provides a ECG channel.
virtual IPlugin::PluginType getType() const
Contains the declaration of the ECGSimulator class.
The ECGProducer class provides a ECG data producer for a given sampling rate.
virtual QWidget * setupWidget()
virtual QSharedPointer< IPlugin > clone() const
static QSharedPointer< PluginOutputData< T > > create(IPlugin *parent, const QString &name, const QString &descr)
virtual QString getName() const