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 
44 {
45  Q_OBJECT
46  Q_DISABLE_COPY(TapSensorChannelInterface)
47 
48 public:
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 
101  {
102  Single = 1,
104  SingleDouble
105  };
106 
113 
120 
121 protected:
122  virtual bool dataReceivedImpl();
123 
124 private Q_SLOTS:
125  void output();
126 
127 Q_SIGNALS:
133  void dataAvailable(const Tap& data);
134 
135 private:
136 
137  QList<TapData> tapValues_;
138  TapSelection type_;
139  QTimer *timer_;
140  static const int doubleClickInteval = 500;
141 };
142 
143 namespace local {
144  typedef ::TapSensorChannelInterface TapSensor;
145 }
146 
147 #endif
Base class for sensor interface.
Base-class for client facades of different sensor types.
Client interface for accessing accelerometer based tap events.
Definition: tapsensor_i.h:44
TapSensorChannelInterface(const QString &path, int sessionId)
Constructor.
void dataAvailable(const Tap &data)
Sent when new tap event has occurred.
static const char * staticInterfaceName
Name of the D-Bus interface for this class.
Definition: tapsensor_i.h:52
virtual bool dataReceivedImpl()
Callback for subclasses in which they must read their expected data from socket.
static const TapSensorChannelInterface * listenInterface(const QString &id)
Request a listening interface to the sensor.
static TapSensorChannelInterface * interface(const QString &id)
Request an interface to the sensor.
static TapSensorChannelInterface * controlInterface(const QString &id)
Request a control interface to the sensor.
static AbstractSensorChannelInterface * factoryMethod(const QString &id, int sessionId)
Create new instance of the class.
TapSelection getTapType()
Get type of taps to be listened for.
TapSelection
Tap type selection.
Definition: tapsensor_i.h:101
@ Single
Only listen single taps.
Definition: tapsensor_i.h:102
@ Double
Only listen double taps.
Definition: tapsensor_i.h:103
@ SingleDouble
Listen both single and double taps.
Definition: tapsensor_i.h:104
void setTapType(TapSelection type)
Set type of taps to be listened for.
QObject facade for TapData.
Definition: tap.h:37
::TapSensorChannelInterface TapSensor
Definition: tapsensor_i.h:144
QObject based datatype for TapData.
Datatype for device tap events.