1 | // Copyright (C) 2016 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 QBLUETOOTHSERVICEINFO_P_H |
5 | #define QBLUETOOTHSERVICEINFO_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 "qbluetoothuuid.h" |
19 | #include "qbluetoothaddress.h" |
20 | #include "qbluetoothdeviceinfo.h" |
21 | #include "qbluetoothserviceinfo.h" |
22 | |
23 | #include <QMap> |
24 | #include <QVariant> |
25 | |
26 | #ifdef Q_OS_MACOS |
27 | #include "darwin/btraii_p.h" |
28 | #endif |
29 | |
30 | class OrgBluezServiceInterface; |
31 | class OrgBluezProfileManager1Interface; |
32 | |
33 | #ifdef QT_WINRT_BLUETOOTH |
34 | #include <wrl.h> |
35 | |
36 | namespace ABI { |
37 | namespace Windows { |
38 | namespace Devices { |
39 | namespace Bluetooth { |
40 | namespace Rfcomm { |
41 | struct IRfcommServiceProvider; |
42 | } |
43 | } |
44 | } |
45 | } |
46 | } |
47 | #endif |
48 | |
49 | QT_BEGIN_NAMESPACE |
50 | |
51 | class QBluetoothServiceInfo; |
52 | |
53 | |
54 | class QBluetoothServiceInfoPrivate |
55 | : public QObject |
56 | { |
57 | Q_OBJECT |
58 | public: |
59 | QBluetoothServiceInfoPrivate(); |
60 | ~QBluetoothServiceInfoPrivate(); |
61 | |
62 | bool registerService(const QBluetoothAddress &localAdapter = QBluetoothAddress()); |
63 | |
64 | bool isRegistered() const; |
65 | |
66 | bool unregisterService(); |
67 | |
68 | QBluetoothDeviceInfo deviceInfo; |
69 | QMap<quint16, QVariant> attributes; |
70 | |
71 | QBluetoothServiceInfo::Sequence protocolDescriptor(QBluetoothUuid::ProtocolUuid protocol) const; |
72 | int serverChannel() const; |
73 | private: |
74 | #if QT_CONFIG(bluez) |
75 | OrgBluezProfileManager1Interface *service = nullptr; |
76 | quint32 serviceRecord; |
77 | QBluetoothAddress currentLocalAdapter; |
78 | QString profilePath; |
79 | #endif |
80 | |
81 | #ifdef QT_WINRT_BLUETOOTH |
82 | Microsoft::WRL::ComPtr<ABI::Windows::Devices::Bluetooth::Rfcomm::IRfcommServiceProvider> serviceProvider; |
83 | |
84 | bool writeSdpAttributes(); |
85 | #endif |
86 | |
87 | #if QT_OSX_BLUETOOTH |
88 | public: |
89 | bool registerService(const QBluetoothServiceInfo &info); |
90 | |
91 | private: |
92 | |
93 | using SDPRecord = DarwinBluetooth::ScopedPointer; |
94 | SDPRecord serviceRecord; |
95 | quint32 serviceRecordHandle = 0; |
96 | #endif // QT_OSX_BLUETOOTH |
97 | |
98 | mutable bool registered = false; |
99 | }; |
100 | |
101 | QT_END_NAMESPACE |
102 | |
103 | #endif // QBLUETOOTHSERVICEINFO_P_H |
104 | |