| 1 | // Copyright (C) 2022 The Qt Company Ltd. |
|---|---|
| 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only |
| 3 | |
| 4 | #ifndef QLEADVERTISER_BLUEZDBUS_P_H |
| 5 | #define QLEADVERTISER_BLUEZDBUS_P_H |
| 6 | |
| 7 | // |
| 8 | // W A R N I N G |
| 9 | // ------------- |
| 10 | // |
| 11 | // This file is not part of the Qt API. It exists purely as an |
| 12 | // implementation detail. This header file may change from version to |
| 13 | // version without notice, or even be removed. |
| 14 | // |
| 15 | // We mean it. |
| 16 | // |
| 17 | |
| 18 | #include "qlowenergyadvertisingdata.h" |
| 19 | #include "qlowenergyadvertisingparameters.h" |
| 20 | |
| 21 | QT_REQUIRE_CONFIG(bluez); |
| 22 | |
| 23 | #include <QtCore/QObject> |
| 24 | |
| 25 | namespace QtBluetoothPrivate { |
| 26 | |
| 27 | class OrgBluezLEAdvertisement1Adaptor; |
| 28 | class OrgBluezLEAdvertisingManager1Interface; |
| 29 | |
| 30 | } // namespace QtBluetoothPrivate |
| 31 | |
| 32 | QT_BEGIN_NAMESPACE |
| 33 | |
| 34 | class QLeDBusAdvertiser : public QObject |
| 35 | { |
| 36 | Q_OBJECT |
| 37 | |
| 38 | public: |
| 39 | QLeDBusAdvertiser(const QLowEnergyAdvertisingParameters ¶ms, |
| 40 | const QLowEnergyAdvertisingData &advertisingData, |
| 41 | const QLowEnergyAdvertisingData &scanResponseData, |
| 42 | const QString &hostAdapterPath, |
| 43 | QObject* parent = nullptr); |
| 44 | ~QLeDBusAdvertiser() override; |
| 45 | |
| 46 | void startAdvertising(); |
| 47 | void stopAdvertising(); |
| 48 | |
| 49 | Q_INVOKABLE void Release(); |
| 50 | |
| 51 | signals: |
| 52 | void errorOccurred(); |
| 53 | |
| 54 | private: |
| 55 | void setDataForDBus(); |
| 56 | void setAdvertisingParamsForDBus(); |
| 57 | void setAdvertisementDataForDBus(); |
| 58 | |
| 59 | private: |
| 60 | const QLowEnergyAdvertisingParameters m_advParams; |
| 61 | QLowEnergyAdvertisingData m_advData; |
| 62 | const QString m_advObjectPath; |
| 63 | QtBluetoothPrivate::OrgBluezLEAdvertisement1Adaptor* const m_advDataDBus; |
| 64 | QtBluetoothPrivate::OrgBluezLEAdvertisingManager1Interface* const m_advManager; |
| 65 | bool m_advertising = false; |
| 66 | }; |
| 67 | |
| 68 | QT_END_NAMESPACE |
| 69 | |
| 70 | #endif // QLEADVERTISER_BLUEZDBUS_P_H |
| 71 |
