blob: a27328ae3828df5ed4156162c9887741b1295667 (
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
|
#ifndef METAWATCHBTTRANSPORT_H
#define METAWATCHBTTRANSPORT_H
#include <QtBluetooth/QBluetoothSocket>
QT_USE_NAMESPACE_BLUETOOTH
#include "metawatchtransport.h"
class MetaWatchBTTransport : public MetaWatchTransport
{
Q_OBJECT
public:
explicit MetaWatchBTTransport(const QBluetoothAddress &address, QObject *parent = 0);
~MetaWatchBTTransport();
bool isDeviceConnected() const;
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 handleSocketConnected();
void handleSocketDisconnected();
void handleSocketData();
private:
QBluetoothAddress _addr;
QBluetoothSocket *_socket;
};
#endif // METAWATCHBTTRANSPORT_H
|