blob: 9b845b9b95c56a05ff9f0bb4571649049f2d243d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
#ifndef STYLUS_H
#define STYLUS_H
#include <QObject>
#include <gato/gatocentralmanager.h>
#include <gato/gatoperipheral.h>
class Stylus : public QObject
{
Q_OBJECT
Q_PROPERTY(qreal pressure READ pressure NOTIFY pressureChanged)
Q_PROPERTY(qreal x READ x NOTIFY xChanged)
Q_PROPERTY(qreal y READ y NOTIFY yChanged)
Q_PROPERTY(qreal z READ z NOTIFY zChanged)
public:
explicit Stylus(QObject *parent = 0);
~Stylus();
qreal pressure() const;
qreal x() const;
qreal y() const;
qreal z() const;
signals:
void autoUpdateChanged();
void pressureChanged();
void xChanged();
void yChanged();
void zChanged();
public slots:
void connectToAnyDevice();
void connectDevice(const QString &addr);
void disconnectDevice();
private:
void connectToPeripheral(GatoPeripheral *peripheral);
private slots:
void handleDiscoveredPeripheral(GatoPeripheral *peripheral, int rssi);
void handleConnected();
void handleDisconnected();
void handleServices();
void handleCharacteristics(const GatoService &service);
void handleValueUpdated(const GatoCharacteristic &characteristic, const QByteArray &value);
void handleReport(int p, int x, int y, int z);
private:
GatoCentralManager *_manager;
GatoPeripheral *_peripheral;
qreal _p;
qreal _x;
qreal _y;
qreal _z;
};
#endif // STYLUS_H
|