| 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 | class OrgBluezLEAdvertisement1Adaptor; |
| 26 | class OrgBluezLEAdvertisingManager1Interface; |
| 27 | |
| 28 | QT_BEGIN_NAMESPACE |
| 29 | |
| 30 | class QLeDBusAdvertiser : public QObject |
| 31 | { |
| 32 | Q_OBJECT |
| 33 | |
| 34 | public: |
| 35 | QLeDBusAdvertiser(const QLowEnergyAdvertisingParameters ¶ms, |
| 36 | const QLowEnergyAdvertisingData &advertisingData, |
| 37 | const QLowEnergyAdvertisingData &scanResponseData, |
| 38 | const QString &hostAdapterPath, |
| 39 | QObject* parent = nullptr); |
| 40 | ~QLeDBusAdvertiser() override; |
| 41 | |
| 42 | void startAdvertising(); |
| 43 | void stopAdvertising(); |
| 44 | |
| 45 | Q_INVOKABLE void Release(); |
| 46 | |
| 47 | signals: |
| 48 | void errorOccurred(); |
| 49 | |
| 50 | private: |
| 51 | void setDataForDBus(); |
| 52 | void setAdvertisingParamsForDBus(); |
| 53 | void setAdvertisementDataForDBus(); |
| 54 | |
| 55 | private: |
| 56 | const QLowEnergyAdvertisingParameters m_advParams; |
| 57 | QLowEnergyAdvertisingData m_advData; |
| 58 | const QString m_advObjectPath; |
| 59 | OrgBluezLEAdvertisement1Adaptor* const m_advDataDBus; |
| 60 | OrgBluezLEAdvertisingManager1Interface* const m_advManager; |
| 61 | bool m_advertising = false; |
| 62 | }; |
| 63 | |
| 64 | QT_END_NAMESPACE |
| 65 | |
| 66 | #endif // QLEADVERTISER_BLUEZDBUS_P_H |
| 67 |
