#ifndef VBLUETOOTH_H #define VBLUETOOTH_H // Qt #include #include // Project #include "VBluetoothDeviceInfo.h" #include "GuiController.h" using namespace Gui; // forward declarations class tst_views; namespace View { class VBluetooth : public QObject { Q_OBJECT public: explicit VBluetooth(QObject *parent = nullptr); protected: Q_PROPERTY(QVariant devices READ doGetDevices NOTIFY didDevicesChanged) Q_PROPERTY(QVariant status READ getStatus NOTIFY didStatusChanged) public slots: void doScanForDevices(); QVariant doGetDevices(); void doSelectDevice(const QString &addr); signals: void didDevicesChanged(); void didSelectDevice(const QString &addr); void didScanFinished(); void didStatusChanged(); void didRequestScanForDevices(); private: QList bleDevices; QString status; QString getStatus() { return status; } private slots: void onScanForDevicesError(QBluetoothDeviceDiscoveryAgent::Error error); void onScanForDevicesFinished(); void onDeviceDiscovered(const QBluetoothDeviceInfo &device); }; } #endif // VBLUETOOTH_H