Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qbluetoothserviceinfo.h
Go to the documentation of this file.
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_H
5#define QBLUETOOTHSERVICEINFO_H
6
7#include <QtBluetooth/qtbluetoothglobal.h>
8
9#include <QtBluetooth/QBluetoothUuid>
10#include <QtBluetooth/QBluetoothAddress>
11
12#include <QtCore/QMetaType>
13#include <QtCore/QList>
14#include <QtCore/QSharedPointer>
15#include <QtCore/QVariant>
16
17#include <QtCore/QDebug>
18
20
23
24class Q_BLUETOOTH_EXPORT QBluetoothServiceInfo
25{
26public:
28 ServiceRecordHandle = 0x0000,
29 ServiceClassIds = 0x0001,
30 ServiceRecordState = 0x0002,
31 ServiceId = 0x0003,
32 ProtocolDescriptorList = 0x0004,
33 BrowseGroupList = 0x0005,
34 LanguageBaseAttributeIdList = 0x0006,
35 ServiceInfoTimeToLive = 0x0007,
36 ServiceAvailability = 0x0008,
37 BluetoothProfileDescriptorList = 0x0009,
38 DocumentationUrl = 0x000A,
39 ClientExecutableUrl = 0x000B,
40 IconUrl = 0x000C,
41 AdditionalProtocolDescriptorList = 0x000D,
42 PrimaryLanguageBase = 0x0100,
43 ServiceName = PrimaryLanguageBase + 0x0000,
44 ServiceDescription = PrimaryLanguageBase + 0x0001,
45 ServiceProvider = PrimaryLanguageBase + 0x0002
46 };
47
48 enum Protocol {
51 RfcommProtocol
52 };
53
54 class Sequence : public QList<QVariant>
55 {
56 public:
58 Sequence(const QList<QVariant> &list) : QList<QVariant>(list) { }
59 };
60
61 class Alternative : public QList<QVariant>
62 {
63 public:
65 Alternative(const QList<QVariant> &list) : QList<QVariant>(list) { }
66 };
67
71
72 bool isValid() const;
73 bool isComplete() const;
74
75 void setDevice(const QBluetoothDeviceInfo &info);
77
78 void setAttribute(quint16 attributeId, const QVariant &value);
79 void setAttribute(quint16 attributeId, const QBluetoothUuid &value);
82 QVariant attribute(quint16 attributeId) const;
83 QList<quint16> attributes() const;
84 bool contains(quint16 attributeId) const;
85 void removeAttribute(quint16 attributeId);
86
87 inline void setServiceName(const QString &name);
88 inline QString serviceName() const;
89 inline void setServiceDescription(const QString &description);
90 inline QString serviceDescription() const;
91 inline void setServiceProvider(const QString &provider);
92 inline QString serviceProvider() const;
93
94 QBluetoothServiceInfo::Protocol socketProtocol() const;
95 int protocolServiceMultiplexer() const;
96 int serverChannel() const;
97
98 QBluetoothServiceInfo::Sequence protocolDescriptor(QBluetoothUuid::ProtocolUuid protocol) const;
99
100 inline void setServiceAvailability(quint8 availability);
101 inline quint8 serviceAvailability() const;
102
103 inline void setServiceUuid(const QBluetoothUuid &uuid);
104 inline QBluetoothUuid serviceUuid() const;
105
106 QList<QBluetoothUuid> serviceClassUuids() const;
107
109
110 bool isRegistered() const;
112 bool unregisterService();
113
114private:
115#ifndef QT_NO_DEBUG_STREAM
117 {
118 return streamingOperator(d, i);
119 }
120 static QDebug streamingOperator(QDebug, const QBluetoothServiceInfo &);
121#endif
122protected:
123 QSharedPointer<QBluetoothServiceInfoPrivate> d_ptr;
124};
125
127
129QT_DECL_METATYPE_EXTERN_TAGGED(QBluetoothServiceInfo::Sequence, QBluetoothServiceInfo__Sequence,
130 Q_BLUETOOTH_EXPORT)
132 QBluetoothServiceInfo__Alternative,
133 Q_BLUETOOTH_EXPORT)
134
136
137inline void QBluetoothServiceInfo::setAttribute(quint16 attributeId, const QBluetoothUuid &value)
138{
140}
141
146
151
156
158{
159 return attribute(ServiceName).toString();
160}
161
166
168{
169 return attribute(ServiceDescription).toString();
170}
171
176
178{
179 return attribute(ServiceProvider).toString();
180}
181
186
191
193{
194 setAttribute(ServiceId, uuid);
195}
196
202
203#endif
IOBluetoothDevice * device
\inmodule QtBluetooth
\inmodule QtBluetooth
Alternative()
Constructs a new empty alternative.
Alternative(const QList< QVariant > &list)
Constructs a new alternative that is a copy of list.
Sequence()
Constructs a new empty sequence.
Sequence(const QList< QVariant > &list)
Constructs a new sequence that is a copy of list.
\inmodule QtBluetooth
void setServiceUuid(const QBluetoothUuid &uuid)
This is a convenience function.
QBluetoothUuid serviceUuid() const
This is a convenience function.
friend QDebug operator<<(QDebug d, const QBluetoothServiceInfo &i)
void setAttribute(quint16 attributeId, const QVariant &value)
Sets the attribute identified by attributeId to value.
QSharedPointer< QBluetoothServiceInfoPrivate > d_ptr
void setServiceProvider(const QString &provider)
This is a convenience function.
void setServiceAvailability(quint8 availability)
This is a convenience function.
Protocol
This enum describes the socket protocol used by the service.
void setServiceDescription(const QString &description)
This is a convenience function.
bool isRegistered() const
Returns true if the service information is registered with the platform's Service Discovery Protocol ...
QString serviceDescription() const
This is a convenience function.
AttributeId
Bluetooth service attributes.
QString serviceProvider() const
This is a convenience function.
bool registerService(const QBluetoothAddress &localAdapter=QBluetoothAddress())
void setServiceName(const QString &name)
This is a convenience function.
void setAttribute(quint16 attributeId, const QBluetoothUuid &value)
This is a convenience function.
QString serviceName() const
This is a convenience function.
quint8 serviceAvailability() const
This is a convenience function.
\inmodule QtBluetooth
ProtocolUuid
This enum is a convienience type for Bluetooth protocol UUIDs.
\inmodule QtCore
Definition qlist.h:75
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
\inmodule QtCore
Definition qvariant.h:65
static auto fromValue(T &&value) noexcept(std::is_nothrow_copy_constructible_v< T > &&Private::CanUseInternalSpace< T >) -> std::enable_if_t< std::conjunction_v< std::is_copy_constructible< T >, std::is_destructible< T > >, QVariant >
Definition qvariant.h:536
Combined button and popup list for selecting options.
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
EGLOutputLayerEXT EGLint attribute
#define QT_DECL_METATYPE_EXTERN(TYPE, EXPORT)
Definition qmetatype.h:1388
#define QT_DECL_METATYPE_EXTERN_TAGGED(TYPE, TAG, EXPORT)
Definition qmetatype.h:1376
static bool contains(const QJsonArray &haystack, unsigned needle)
Definition qopengl.cpp:116
GLuint name
unsigned short quint16
Definition qtypes.h:48
unsigned char quint8
Definition qtypes.h:46
QList< int > list
[14]
QSharedPointer< T > other(t)
[5]
app setAttribute(Qt::AA_DontShowIconsInMenus)
QHostInfo info
[0]