BluezQt 5.109.0
profile.h
1/*
2 * BluezQt - Asynchronous BlueZ wrapper library
3 *
4 * SPDX-FileCopyrightText: 2014-2015 David Rosca <nowrep@gmail.com>
5 *
6 * SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
7 */
8
9#ifndef BLUEZQT_PROFILE_H
10#define BLUEZQT_PROFILE_H
11
12#include <QObject>
13
14#include "bluezqt_export.h"
15#include "request.h"
16#include "types.h"
17
18class QLocalSocket;
19class QDBusObjectPath;
20class QDBusUnixFileDescriptor;
21
22namespace BluezQt
23{
24class Device;
25
46class BLUEZQT_EXPORT Profile : public QObject
47{
48 Q_OBJECT
49
50 Q_PROPERTY(QString uuid READ uuid)
51
52public:
54 enum LocalRole {
59 };
60
66 explicit Profile(QObject *parent = nullptr);
67
71 ~Profile() override;
72
82 virtual QDBusObjectPath objectPath() const = 0;
83
89 virtual QString uuid() const = 0;
90
96 void setName(const QString &name);
97
103 void setService(const QString &service);
104
115
125 void setChannel(quint16 channel);
126
138 void setPsm(quint16 psm);
139
145 void setRequireAuthentication(bool require);
146
152 void setRequireAuthorization(bool require);
153
163 void setAutoConnect(bool autoConnect);
164
173 void setServiceRecord(const QString &serviceRecord);
174
180 void setVersion(quint16 version);
181
187 void setFeatures(quint16 features);
188
197 QSharedPointer<QLocalSocket> createSocket(const QDBusUnixFileDescriptor &fd);
198
223 virtual void newConnection(DevicePtr device, const QDBusUnixFileDescriptor &fd, const QVariantMap &properties, const Request<> &request);
224
233 virtual void requestDisconnection(DevicePtr device, const Request<> &request);
234
246 virtual void release();
247
248private:
249 class ProfilePrivate *const d;
250
251 friend class Manager;
252};
253
254} // namespace BluezQt
255
256#endif // BLUEZQT_PROFILE_H
Bluetooth manager.
Definition manager.h:78
Bluetooth profile.
Definition profile.h:47
virtual void newConnection(DevicePtr device, const QDBusUnixFileDescriptor &fd, const QVariantMap &properties, const Request<> &request)
Requests the new connection.
void setServiceRecord(const QString &serviceRecord)
Sets a SDP record.
void setLocalRole(LocalRole role)
Sets the local role to identify side.
QSharedPointer< QLocalSocket > createSocket(const QDBusUnixFileDescriptor &fd)
Creates a socket from file descriptor.
void setRequireAuthorization(bool require)
Sets whether the authorization is required to connect.
virtual void release()
Indicates that the profile was unregistered.
Profile(QObject *parent=nullptr)
Creates a new Profile object.
void setName(const QString &name)
Sets the human readable name of the profile.
void setAutoConnect(bool autoConnect)
Sets whether the profile is automatically connected.
void setRequireAuthentication(bool require)
Sets whether the pairing is required to connect.
virtual QString uuid() const =0
UUID of the profile.
void setFeatures(quint16 features)
Sets the profile features.
void setService(const QString &service)
Sets the primary service class UUID (if different from profile UUID).
virtual void requestDisconnection(DevicePtr device, const Request<> &request)
Requests the disconnection of the profile.
void setPsm(quint16 psm)
Sets the L2CAP port number.
LocalRole
Local role to identify sides in asymmetric profiles.
Definition profile.h:54
@ ClientRole
Indicates that this is a client.
Definition profile.h:56
@ ServerRole
Indicates that this is a server.
Definition profile.h:58
void setVersion(quint16 version)
Sets the profile version.
~Profile() override
Destroys a Profile object.
virtual QDBusObjectPath objectPath() const =0
D-Bus object path of the profile.
void setChannel(quint16 channel)
Sets the RFCOMM channel number.
D-Bus request.
Definition request.h:39