SkyPulse UAV V0.1
Loading...
Searching...
No Matches
Bluetooth.h
Go to the documentation of this file.
1#ifndef BLUETOOTH_H
2#define BLUETOOTH_H
3
4#include <QObject>
5#include <QtBluetooth/QBluetoothDeviceDiscoveryAgent>
6#include <QtBluetooth/QBluetoothSocket>
7
8
9class Bluetooth : public QObject
10{
11 Q_OBJECT
12public:
13 explicit Bluetooth(QObject *parent = nullptr);
14 ~Bluetooth();
15
17 void connectToDevice(const QBluetoothDeviceInfo &deviceInfo);
18 void send(const QByteArray &data);
19
20signals:
21 void deviceDiscovered(const QBluetoothDeviceInfo &deviceInfro);
22 void connected();
24 void dataReceived(const QByteArray &data);
25
26private slots:
27 void onDeviceDiscovered(const QBluetoothDeviceInfo &deviceInfo);
28 void onConnected();
29 void onDisconnected();
30 void onReadyRead();
31
32private:
33 QBluetoothDeviceDiscoveryAgent *discoveryAgent;
34 QBluetoothSocket *socket;
35
36};
37
38#endif // BLUETOOTH_H
Definition Bluetooth.h:10
void connected()
void dataReceived(const QByteArray &data)
Bluetooth(QObject *parent=nullptr)
Definition Bluetooth.cpp:3
void deviceDiscovered(const QBluetoothDeviceInfo &deviceInfro)
void send(const QByteArray &data)
Definition Bluetooth.cpp:29
void disconnected()
~Bluetooth()
Definition Bluetooth.cpp:14
void connectToDevice(const QBluetoothDeviceInfo &deviceInfo)
Definition Bluetooth.cpp:24
void startDeviceDiscovery()
Definition Bluetooth.cpp:19