QGroundControl
Ground Control Station for MAVLink Drones
Loading...
Searching...
No Matches
BluetoothClassicWorker.h
Go to the documentation of this file.
1#pragma once
2
3#include "BluetoothWorker.h"
4
5#include <QtBluetooth/QBluetoothServiceDiscoveryAgent>
6#include <QtBluetooth/QBluetoothServiceInfo>
7#include <QtBluetooth/QBluetoothSocket>
8
10{
11 Q_OBJECT
12
13public:
14 explicit BluetoothClassicWorker(const BluetoothConfiguration *config, QObject *parent = nullptr);
15 ~BluetoothClassicWorker() override;
16
17protected:
18 void onSetupConnection() override;
19 void onConnectLink() override;
20 void onDisconnectLink() override;
21 void onWriteData(const QByteArray &data) override;
22 void onServiceDiscoveryTimeout() override;
23 void onResetAfterConsecutiveFailures() override;
24
25private slots:
26 void _onSocketConnected();
27 void _onSocketDisconnected();
28 void _onSocketReadyRead();
29 void _onSocketBytesWritten(qint64 bytes);
30 void _onSocketErrorOccurred(QBluetoothSocket::SocketError socketError);
31 void _onClassicServiceDiscovered(const QBluetoothServiceInfo &serviceInfo);
32 void _onClassicServiceDiscoveryFinished();
33 void _onClassicServiceDiscoveryCanceled();
34 void _onClassicServiceDiscoveryError(QBluetoothServiceDiscoveryAgent::Error error);
35
36private:
37 void _setupClassicSocket();
38 void _startClassicServiceDiscovery();
39 void _writeClassicData(const QByteArray &data);
40
41 QPointer<QBluetoothSocket> _socket;
42 QPointer<QBluetoothServiceDiscoveryAgent> _classicDiscovery;
43 QBluetoothServiceInfo _classicDiscoveredService;
44
45 static inline const QBluetoothUuid SPP_UUID{QBluetoothUuid::ServiceClassUuid::SerialPort};
46};
Error error
void onWriteData(const QByteArray &data) override
void onResetAfterConsecutiveFailures() override
void onServiceDiscoveryTimeout() override