sensorfw: sensors/stepcountersensor/stepcountersensor.h Source File

sensorfw

stepcountersensor.h
Go to the documentation of this file.
1
28#ifndef STEPCOUNTER_SENSOR_CHANNEL_H
29#define STEPCOUNTER_SENSOR_CHANNEL_H
30
31#include <QObject>
32
33#include "deviceadaptor.h"
34#include "abstractsensor.h"
35#include "stepcountersensor_a.h"
36#include "dataemitter.h"
37#include "datatypes/timedunsigned.h"
38#include "datatypes/unsigned.h"
39
40class Bin;
41template <class TYPE> class BufferReader;
42class FilterBase;
43
49 class StepCounterSensorChannel :
50 public AbstractSensorChannel,
51 public DataEmitter<TimedUnsigned>
52{
53 Q_OBJECT;
54 Q_PROPERTY(Unsigned steps READ steps);
55
56public:
61 static AbstractSensorChannel* factoryMethod(const QString& id)
62 {
63 StepCounterSensorChannel* sc = new StepCounterSensorChannel(id);
64 new StepCounterSensorChannelAdaptor(sc);
65
66 return sc;
67 }
68
73 Unsigned steps() const { return previousValue_; }
74
75public Q_SLOTS:
76 bool start();
77 bool stop();
78
79signals:
84 void StepCounterChanged(const Unsigned& value);
85
86protected:
87 StepCounterSensorChannel(const QString& id);
88 virtual ~StepCounterSensorChannel();
89
90private:
91 TimedUnsigned previousValue_;
92 Bin* filterBin_;
93 Bin* marshallingBin_;
94 DeviceAdaptor* stepcounterAdaptor_;
95 BufferReader<TimedUnsigned>* stepcounterReader_;
96 RingBuffer<TimedUnsigned>* outputBuffer_;
97
98 void emitData(const TimedUnsigned& value);
99};
100
101#endif // STEPCOUNTER_SENSOR_CHANNEL_H
BufferReader
Definition accelerometersensor.h:38
StepCounterSensorChannelAdaptor
Definition stepcountersensor_a.h:39
StepCounterSensorChannel
Sensor for accessing the internal step counter sensor measurements.
Definition stepcountersensor.h:52
StepCounterSensorChannel::stop
bool stop()
StepCounterSensorChannel::steps
Unsigned steps() const
Property for accessing the measured value.
Definition stepcountersensor.h:73
StepCounterSensorChannel::factoryMethod
static AbstractSensorChannel * factoryMethod(const QString &id)
Factory method for StepCounterSensorChannel.
Definition stepcountersensor.h:61
StepCounterSensorChannel::start
bool start()
StepCounterSensorChannel::steps
Unsigned steps
Definition stepcountersensor.h:54
StepCounterSensorChannel::~StepCounterSensorChannel
virtual ~StepCounterSensorChannel()
StepCounterSensorChannel::StepCounterChanged
void StepCounterChanged(const Unsigned &value)
Sent when a change in measured data is observed.
StepCounterSensorChannel::StepCounterSensorChannel
StepCounterSensorChannel(const QString &id)
TimedUnsigned
Datatype for unsigned integer value with timestamp.
Definition timedunsigned.h:34
Unsigned
QObject facae for TimedUnsigned.
Definition unsigned.h:37
stepcountersensor_a.h
D-Bus adaptor for stepcounter sensor.
timedunsigned.h
Datatype for unsigned values.
unsigned.h
QObject based datatype for TimedUnsigned.