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
21QT_REQUIRE_CONFIG(bluez);
22
23#include <QtCore/QObject>
24
25class OrgBluezLEAdvertisement1Adaptor;
26class OrgBluezLEAdvertisingManager1Interface;
27
28QT_BEGIN_NAMESPACE
29
30class QLeDBusAdvertiser : public QObject
31{
32 Q_OBJECT
33
34public:
35 QLeDBusAdvertiser(const QLowEnergyAdvertisingParameters &params,
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
47signals:
48 void errorOccurred();
49
50private:
51 void setDataForDBus();
52 void setAdvertisingParamsForDBus();
53 void setAdvertisementDataForDBus();
54
55private:
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
64QT_END_NAMESPACE
65
66#endif // QLEADVERTISER_BLUEZDBUS_P_H
67

source code of qtconnectivity/src/bluetooth/qleadvertiser_bluezdbus_p.h