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,
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
static const TapSensorChannelInterface * listenInterface(const QString &id)
Request a listening interface to the sensor.
static AbstractSensorChannelInterface * factoryMethod(const QString &id, int sessionId)
Create new instance of the class.
Base class for sensor interface.
Client interface for accessing accelerometer based tap events.
Definition: tapsensor_i.h:43
Base-class for client facades of different sensor types.
virtual bool dataReceivedImpl()
Callback for subclasses in which they must read their expected data from socket.
void dataAvailable(const Tap &data)
Sent when new tap event has occurred.
TapSelection getTapType()
Get type of taps to be listened for.
int sessionId() const
Get ID of the current session.
TapSelection
Tap type selection.
Definition: tapsensor_i.h:100
::TapSensorChannelInterface TapSensor
Definition: tapsensor_i.h:144
static TapSensorChannelInterface * controlInterface(const QString &id)
Request a control interface to the sensor.
QString type()
Textual description about sensor type.
static TapSensorChannelInterface * interface(const QString &id)
Request an interface to the sensor.
Only listen double taps.
Definition: tapsensor_i.h:103
QObject facade for TapData.
Definition: tap.h:36
Listen both single and double taps.
Definition: tapsensor_i.h:104
void setTapType(TapSelection type)
Set type of taps to be listened for.
QObject based datatype for TapData.
Only listen single taps.
Definition: tapsensor_i.h:102
Datatype for device tap events.
static const char * staticInterfaceName
Name of the D-Bus interface for this class.
Definition: tapsensor_i.h:52
TapSensorChannelInterface(const QString &path, int sessionId)
Constructor.