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