blob: 973c4a8496e0969939f6bd6c2a2e8de1ee493d52 (
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
|
#ifndef METAWATCHBLETRANSPORT_H
#define METAWATCHBLETRANSPORT_H
#include <QtCore/QObject>
#include <gato/gatoperipheral.h>
#include <gato/gatouuid.h>
#include <gato/gatoservice.h>
#include <gato/gatocharacteristic.h>
#include "metawatchtransport.h"
class MetaWatchBLETransport : public MetaWatchTransport
{
Q_OBJECT
public:
explicit MetaWatchBLETransport(GatoPeripheral *peripheral, QObject *parent = 0);
~MetaWatchBLETransport();
static const GatoUUID ServiceUuid;
static const GatoUUID InputCharacteristicUuid;
static const GatoUUID OutputCharacteristicUuid;
void sendMessage(quint8 type, quint8 options, const QByteArray &payload);
public slots:
void connectDevice();
void disconnectDevice();
private:
static QByteArray encode(quint8 type, quint8 options, const QByteArray &payload);
static bool decode(const QByteArray &msg, quint8 *type, quint8 *options, QByteArray *payload);
private slots:
void handleDeviceConnected();
void handleDeviceDisconnected();
void handleDeviceServices();
void handleDeviceCharacteristics(const GatoService &service);
void handleDeviceUpdate(const GatoCharacteristic &characteristic, const QByteArray &value);
private:
GatoPeripheral *_dev;
GatoCharacteristic _in, _out;
};
#endif // METAWATCHBLETRANSPORT_H
|