sensorfw: qt-api/tapsensor_i.h Source File

sensorfw

tapsensor_i.h
Go to the documentation of this file.
1
28#ifndef TAPSENSOR_I_H
29#define TAPSENSOR_I_H
30
31#include <QtDBus/QtDBus>
32
33#include "abstractsensor_i.h"
34#include "datatypes/tap.h"
35#include "datatypes/tapdata.h"
36#include <QList>
37#include <QTimer>
38
39
43 class TapSensorChannelInterface : public AbstractSensorChannelInterface
44{
45 Q_OBJECT
46 Q_DISABLE_COPY(TapSensorChannelInterface)
47
48public:
52 static const char* staticInterfaceName;
53
61 static AbstractSensorChannelInterface* factoryMethod(const QString& id, int sessionId);
62
69 TapSensorChannelInterface(const QString &path, int sessionId);
70
78 static const TapSensorChannelInterface* listenInterface(const QString& id);
79
87 static TapSensorChannelInterface* controlInterface(const QString& id);
88
95 static TapSensorChannelInterface* interface(const QString& id);
96
100 enum TapSelection
101 {
102 Single = 1,
103 Double,
104 SingleDouble
105 };
106
112 void setTapType(TapSelection type);
113
119 TapSelection getTapType();
120
121protected:
122 virtual bool dataReceivedImpl();
123
124private Q_SLOTS:
125 void output();
126
127Q_SIGNALS:
133 void dataAvailable(const Tap& data);
134
135private:
136
137 QList<TapData> tapValues_;
138 TapSelection type_;
139 QTimer *timer_;
140 static const int doubleClickInteval = 500;
141};
142
143namespace local {
144 typedef ::TapSensorChannelInterface TapSensor;
145}
146
147#endif
abstractsensor_i.h
Base class for sensor interface.
AbstractSensorChannelInterface
Base-class for client facades of different sensor types.
Definition: abstractsensor_i.h:46
AbstractSensorChannelInterface::sessionId
int sessionId
Definition: abstractsensor_i.h:49
AbstractSensorChannelInterface::type
QString type
Definition: abstractsensor_i.h:56
TapSensorChannelInterface
Client interface for accessing accelerometer based tap events.
Definition: tapsensor_i.h:44
TapSensorChannelInterface::TapSensorChannelInterface
TapSensorChannelInterface(const QString &path, int sessionId)
Constructor.
TapSensorChannelInterface::dataAvailable
void dataAvailable(const Tap &data)
Sent when new tap event has occurred.
TapSensorChannelInterface::staticInterfaceName
static const char * staticInterfaceName
Name of the D-Bus interface for this class.
Definition: tapsensor_i.h:52
TapSensorChannelInterface::dataReceivedImpl
virtual bool dataReceivedImpl()
Callback for subclasses in which they must read their expected data from socket.
TapSensorChannelInterface::interface
static TapSensorChannelInterface * interface(const QString &id)
Request an interface to the sensor.
TapSensorChannelInterface::factoryMethod
static AbstractSensorChannelInterface * factoryMethod(const QString &id, int sessionId)
Create new instance of the class.
TapSensorChannelInterface::listenInterface
static const TapSensorChannelInterface * listenInterface(const QString &id)
Request a listening interface to the sensor.
TapSensorChannelInterface::controlInterface
static TapSensorChannelInterface * controlInterface(const QString &id)
Request a control interface to the sensor.
TapSensorChannelInterface::getTapType
TapSelection getTapType()
Get type of taps to be listened for.
TapSensorChannelInterface::TapSelection
TapSelection
Tap type selection.
Definition: tapsensor_i.h:101
TapSensorChannelInterface::Single
@ Single
Only listen single taps.
Definition: tapsensor_i.h:102
TapSensorChannelInterface::Double
@ Double
Only listen double taps.
Definition: tapsensor_i.h:103
TapSensorChannelInterface::SingleDouble
@ SingleDouble
Listen both single and double taps.
Definition: tapsensor_i.h:104
TapSensorChannelInterface::setTapType
void setTapType(TapSelection type)
Set type of taps to be listened for.
Tap
QObject facade for TapData.
Definition: tap.h:37
local
Definition: abstractsensor_i.h:516
local::TapSensor
::TapSensorChannelInterface TapSensor
Definition: tapsensor_i.h:144
tap.h
QObject based datatype for TapData.
tapdata.h
Datatype for device tap events.