Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #ifndef BLUETOOTH_BRIDGE_H
- #define BLUETOOTH_BRIDGE_H
- #include <QObject>
- #include <QBluetoothDeviceDiscoveryAgent>
- #include <QBluetoothLocalDevice>
- #include <QLowEnergyController>
- #include "device_info.h"
- class device_Info;
- class service_Info;
- class bluetooth_Bridge : public QObject {
- Q_OBJECT
- public:
- bluetooth_Bridge(QObject *parent = nullptr);
- Q_INVOKABLE void scan_Devices();
- void clear_Devices();
- void connect_Device(device_Info *device);
- private slots:
- void S_add_Device(const QBluetoothDeviceInfo&);
- void S_device_Scan_Finished();
- void S_device_Scan_Error(QBluetoothDeviceDiscoveryAgent::Error);
- void S_device_Connected();
- void S_device_Disconnected();
- void S_service_Discovered(const QBluetoothUuid &gatt);
- void S_service_Scan_Done();
- void S_BLE_Controller_Error(QLowEnergyController::Error);
- void S_service_State_Changed(QLowEnergyService::ServiceState state);
- void S_service_Characteristic_Changed(const QLowEnergyCharacteristic &characteristic, const QByteArray &value);
- void S_service_Characteristic_Read(const QLowEnergyCharacteristic &characteristic, const QByteArray &value);
- void S_service_Error(QLowEnergyService::ServiceError error);
- signals:
- void devices_Changed();
- private:
- bool _display_Service_Found;
- QList<QObject*> _BLE_Devices;
- QList<QBluetoothUuid> _BLE_Services_UUID;
- device_Info *_current_Device = nullptr;
- QBluetoothDeviceDiscoveryAgent *_device_Discovery_Agent;
- QLowEnergyController *_BLE_Controller = nullptr;
- QLowEnergyService *_BLE_Service = nullptr;
- };
- #endif // BLUETOOTH_BRIDGE_H
Add Comment
Please, Sign In to add comment