summaryrefslogtreecommitdiff
path: root/sensorPlugins/heartrateSensor.h
diff options
context:
space:
mode:
authorArseniy-Movshev <dodoradio@outlook.com>2023-03-06 20:59:36 +0000
committerArseniy-Movshev <dodoradio@outlook.com>2023-03-07 21:44:42 +0000
commit222f776d9f9d1f362038d26f835c96918a7af5fe (patch)
treee1c5b01753d52603bc9d8e5cb91c1cf3287a8ba9 /sensorPlugins/heartrateSensor.h
parent31a0592f40ccbe0ed31abcd8bf39c2c00dab699a (diff)
Refactor sensors into separate files
- this should make things a lot easier to maintain. instead of having everything in the same file, each sensor provides a constructor that sets it up correctly etc. - this should also get the step counter running when the service starts, which is necessary, since the sensor won't count on most devices unless the service is running. - this also temporarily removes the gps module from the service. it's not implemented right now anyway.
Diffstat (limited to 'sensorPlugins/heartrateSensor.h')
-rw-r--r--sensorPlugins/heartrateSensor.h33
1 files changed, 33 insertions, 0 deletions
diff --git a/sensorPlugins/heartrateSensor.h b/sensorPlugins/heartrateSensor.h
new file mode 100644
index 0000000..f6f98e0
--- /dev/null
+++ b/sensorPlugins/heartrateSensor.h
@@ -0,0 +1,33 @@
+#ifndef HEARTRATESENSOR_H
+#define HEARTRATESENSOR_H
+
+#include <QObject>
+#include <QDateTime>
+#include <QDBusInterface>
+#include <QTimer>
+
+#include <QtSensors/QHrmSensor>
+
+class HeartrateSensorPlugin : public QObject
+{
+ Q_OBJECT
+public:
+ explicit HeartrateSensorPlugin(QObject *parent = 0, int initInterval = 600000);
+ virtual ~HeartrateSensorPlugin() {};
+
+ void timeUpdate();
+
+public slots:
+ void triggerRecording();
+
+private slots:
+ void finishRecording();
+
+private:
+ QDateTime lastRecordTime;
+ int interval;
+ QTimer *recordIntervalTimer;
+ QHrmSensor *hrmSensor;
+};
+
+#endif // HEARTRATESENSOR_H