Line data Source code
1 : // SPDX-FileCopyrightText: 2022-2023 Paul Colby <git@colby.id.au> 2 : // SPDX-License-Identifier: LGPL-3.0-or-later 3 : 4 : /*! 5 : * \file 6 : * Declares the PokitDiscoveryAgent class. 7 : */ 8 : 9 : #ifndef QTPOKIT_POKITDISCOVERYAGENT_H 10 : #define QTPOKIT_POKITDISCOVERYAGENT_H 11 : 12 : #include "qtpokit_global.h" 13 : 14 : #include <QBluetoothDeviceDiscoveryAgent> 15 : 16 : QTPOKIT_BEGIN_NAMESPACE 17 : 18 : class PokitDiscoveryAgentPrivate; 19 : 20 : class QTPOKIT_EXPORT PokitDiscoveryAgent : public QBluetoothDeviceDiscoveryAgent 21 : { 22 18 : Q_OBJECT 23 : 24 : public: 25 : explicit PokitDiscoveryAgent(const QBluetoothAddress &deviceAdapter, QObject *parent=nullptr); 26 : PokitDiscoveryAgent(QObject * parent=nullptr); 27 : virtual ~PokitDiscoveryAgent(); 28 : 29 : static bool isPokitDevice(const QBluetoothDeviceInfo &info); 30 : static bool isPokitMeter(const QBluetoothDeviceInfo &info); 31 : static bool isPokitPro(const QBluetoothDeviceInfo &info); 32 : 33 : public slots: 34 : void start(QBluetoothDeviceDiscoveryAgent::DiscoveryMethods methods); 35 : void start(); 36 : 37 : signals: 38 : void pokitDeviceDiscovered(const QBluetoothDeviceInfo &info); 39 : #if (QT_VERSION >= QT_VERSION_CHECK(5, 12, 0)) // Required signal, and Fields, added in Qt 5.12. 40 : void pokitDeviceUpdated(const QBluetoothDeviceInfo &info, QBluetoothDeviceInfo::Fields updatedFields); 41 : #endif 42 : 43 : protected: 44 : /// \cond internal 45 : PokitDiscoveryAgentPrivate * d_ptr; ///< Internal d-pointer. 46 : PokitDiscoveryAgent(PokitDiscoveryAgentPrivate * const d, 47 : const QBluetoothAddress &deviceAdapter, QObject * const parent); 48 : PokitDiscoveryAgent(PokitDiscoveryAgentPrivate * const d, QObject * const parent); 49 : /// \endcond 50 : 51 : private: 52 302 : Q_DECLARE_PRIVATE(PokitDiscoveryAgent) 53 : Q_DISABLE_COPY(PokitDiscoveryAgent) 54 : friend class TestPokitDiscoveryAgent; 55 : }; 56 : 57 : QTPOKIT_END_NAMESPACE 58 : 59 : #endif // QTPOKIT_POKITDISCOVERYAGENT_H