From 1e327a6d6d5eac09f5692d9091043e87ea688e5d Mon Sep 17 00:00:00 2001 From: Javier Date: Tue, 13 Jan 2015 11:29:11 +0100 Subject: initial import --- src/stylus.h | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 src/stylus.h (limited to 'src/stylus.h') diff --git a/src/stylus.h b/src/stylus.h new file mode 100644 index 0000000..9b845b9 --- /dev/null +++ b/src/stylus.h @@ -0,0 +1,59 @@ +#ifndef STYLUS_H +#define STYLUS_H + +#include +#include +#include + +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 -- cgit v1.2.3