QGroundControl
Ground Control Station for MAVLink Drones
Loading...
Searching...
No Matches
BluetoothLink.h
Go to the documentation of this file.
1#pragma once
2
4#include "LinkInterface.h"
5
6#include <QtCore/QPointer>
7
8#include <atomic>
9
10class BluetoothWorker;
11class QThread;
12
14{
15 Q_OBJECT
16
17public:
18 explicit BluetoothLink(SharedLinkConfigurationPtr &config, QObject *parent = nullptr);
19 ~BluetoothLink() override;
20
21 bool isConnected() const override;
22 void disconnect() override;
23
24private slots:
25 void _writeBytes(const QByteArray &bytes) override;
26 void _onConnected();
27 void _onDisconnected();
28 void _onErrorOccurred(const QString &errorString);
29 void _onDataReceived(const QByteArray &data);
30 void _onDataSent(const QByteArray &data);
31 void _onRssiUpdated(qint16 rssi);
32
33private:
34 bool _connect() override;
35 void _checkPermission();
36 void _handlePermissionStatus(Qt::PermissionStatus permissionStatus);
37
38 BluetoothConfiguration *_bluetoothConfig = nullptr;
39 QPointer<BluetoothWorker> _worker;
40 QPointer<QThread> _workerThread;
41 std::atomic<bool> _connectedCache{false};
42 std::atomic<bool> _disconnectedEmitted{false};
43};
std::shared_ptr< LinkConfiguration > SharedLinkConfigurationPtr
QString errorString
The link interface defines the interface for all links used to communicate with the ground station ap...