9 #include <QCoreApplication> 18 privateSamples =
new QVector<QVector<QPointF> >;
29 delete privateSamples;
37 prevTime = clock.elapsed();
42 double elapsed = clock.elapsed();
47 const double usec = (sleepInterval-(clock.elapsed()-elapsed))*1000;
70 QString iniPath = qApp->applicationDirPath() +
"/settings.ini";
71 QSettings settings(iniPath, QSettings::IniFormat);
80 qDebug() <<
"SourceID:" << sourceId << endl;
103 switch (sampleRate) {
106 sleepInterval = 1.70;
111 sleepInterval = 0.70;
121 sleepInterval = 0.70;
126 ecg->
init(source, freq);
133 privateSamples->clear();
156 if (ftype ==
"text") {
158 }
else if (ftype ==
"bdf") {
167 void SamplingThread::saveAsText()
222 void SamplingThread::saveAsBDF()
325 void SamplingThread::sample(
double elapsed,
DataStream& inputStream){
331 QVector<double> frame;
332 frame.append(elapsed);
335 static double lead1, lead2, lead3, respiration;
336 static bool userNotified =
false;
348 lead1 += frame.at(1);
349 lead2 += frame.at(2);
350 lead3 += frame.at(3);
351 respiration += frame.at(4);
353 inputStream.push_back(
EcgStreamObject(frame.at(1), frame.at(2),frame.at(3), frame.at(4),elapsed/1000));
359 QVector<QPointF> tmp;
360 tmp << QPointF(elapsed/1000,lead1/10) << QPointF(elapsed/1000,lead2/10) << QPointF(elapsed/1000,lead3/10) << QPointF(elapsed/1000, respiration/10);
362 privateSamples->append(tmp);
372 if (privateSamples->size() >= 20) {
373 QVector<QVector<QPointF> > sampleVector = *privateSamples;
375 privateSamples->clear();
389 prevTime = clock.elapsed();
391 for (
int ii=0; ii<30000 ;ii++) {
393 double elapsed = clock.elapsed();
394 sample(elapsed, inputStream);
398 const double usec = (sleepInterval-(clock.elapsed()-elapsed))*1000;
const QVector< double > readFrame()
Reads a single frame.
int getSampleRate()
Returns a int containing the value from private int sampleRate.
void sendSampleVector(QVector< QVector< QPointF > >)
void setFileName(QString)
void setFileType(QString)
Responsible for communication with ADAS.
void start()
Start capturing frames from the ADAS1000.
virtual void getData(DataStream &)
Populates DataStream vector with values.
SamplingThread(DataStream &inputStream)
static SettingsSingleton & instance()
Retrives a reference to the ONE and ONLY SettingsSingleton created for the application.
QString getFileName()
Returns a QString containing the value from private QString fileName.
void init(OperatingMode, Frequency)
Initiate the device by configuring the registers depending on operating mode and sampling frequency...
void updateStatus(QString)
Abstract Interface that should be used for storing data in the memory.
virtual void close()
Closes the connection to bcm2835.
virtual bool connected()
Boolean for check whether the device is connected<.
Struct to store Biosignal data from a specific time, combined with DataStream it will store a sequenc...
int getSourceId()
Returns a int containing the value from private int sourceId.
Abstract interface for all devices.
virtual ~SamplingThread()