-
Notifications
You must be signed in to change notification settings - Fork 0
/
hcworker.h
38 lines (31 loc) · 981 Bytes
/
hcworker.h
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 HCWORKER_H
#define HCWORKER_H
#include <QObject>
#include <QBluetoothDeviceInfo>
#include <QBluetoothUuid>
#include <QLowEnergyController>
class HCWorker : public QObject
{
Q_OBJECT
public:
explicit HCWorker(QObject *parent = nullptr);
virtual ~HCWorker();
QString readData();
void writeData(QString);
signals:
void hcFound(const QBluetoothDeviceInfo &device);
void message(QString);
protected slots:
void deviceDiscovered(const QBluetoothDeviceInfo &device);
void hcConnect(const QBluetoothDeviceInfo &device);
void statUpdate(QLowEnergyService::ServiceState);
void newMessage(QLowEnergyCharacteristic, QByteArray);
void handleError(QLowEnergyService::ServiceError);
private:
QBluetoothUuid hc = QUuid("{0000ffe0-0000-1000-8000-00805f9b34fb}");
QLowEnergyController* controller;
QLowEnergyService* service;
QLowEnergyCharacteristic reader;
QLowEnergyCharacteristic writer;
};
#endif // HCWORKER_H