BluezQt 5.109.0
|
Bluetooth profile. More...
#include <BluezQt/Profile>
Public Types | |
enum | LocalRole { ClientRole , ServerRole } |
Local role to identify sides in asymmetric profiles. More... | |
Properties | |
QString | uuid |
Public Member Functions | |
Profile (QObject *parent=nullptr) | |
Creates a new Profile object. | |
~Profile () override | |
Destroys a Profile object. | |
QSharedPointer< QLocalSocket > | createSocket (const QDBusUnixFileDescriptor &fd) |
Creates a socket from file descriptor. | |
virtual void | newConnection (DevicePtr device, const QDBusUnixFileDescriptor &fd, const QVariantMap &properties, const Request<> &request) |
Requests the new connection. | |
virtual QDBusObjectPath | objectPath () const =0 |
D-Bus object path of the profile. | |
virtual void | release () |
Indicates that the profile was unregistered. | |
virtual void | requestDisconnection (DevicePtr device, const Request<> &request) |
Requests the disconnection of the profile. | |
void | setAutoConnect (bool autoConnect) |
Sets whether the profile is automatically connected. | |
void | setChannel (quint16 channel) |
Sets the RFCOMM channel number. | |
void | setFeatures (quint16 features) |
Sets the profile features. | |
void | setLocalRole (LocalRole role) |
Sets the local role to identify side. | |
void | setName (const QString &name) |
Sets the human readable name of the profile. | |
void | setPsm (quint16 psm) |
Sets the L2CAP port number. | |
void | setRequireAuthentication (bool require) |
Sets whether the pairing is required to connect. | |
void | setRequireAuthorization (bool require) |
Sets whether the authorization is required to connect. | |
void | setService (const QString &service) |
Sets the primary service class UUID (if different from profile UUID). | |
void | setServiceRecord (const QString &serviceRecord) |
Sets a SDP record. | |
void | setVersion (quint16 version) |
Sets the profile version. | |
virtual QString | uuid () const =0 |
UUID of the profile. | |
Bluetooth profile.
This class represents a Bluetooth profile.
It is only needed to reimplement pure virtual functions. You don't need to set any additional properties.
But you may need to specify at least channel number or PSM in case it couldn't be determined from UUID. It is also a good idea to provide name for the profile.
Setting the channel number with setChannel() will make the profile use RFCOMM, while setting the PSM with setPsm() will make the profile use L2CAP.
|
explicit |
Creates a new Profile object.
parent |
|
override |
Destroys a Profile object.
QSharedPointer< QLocalSocket > BluezQt::Profile::createSocket | ( | const QDBusUnixFileDescriptor & | fd | ) |
Creates a socket from file descriptor.
fd | socket file descriptor |
|
virtual |
Requests the new connection.
Common properties:
To create socket from fd, you can use:
device | device that requested connection |
fd | socket file descriptor |
properties | additional properties |
request | request to be used for sending reply |
|
pure virtual |
D-Bus object path of the profile.
The path where the profile will be registered.
|
virtual |
Indicates that the profile was unregistered.
This method gets called when the Bluetooth daemon unregisters the profile.
A profile can use it to do cleanup tasks. There is no need to unregister the profile, because when this method gets called it has already been unregistered.
|
virtual |
Requests the disconnection of the profile.
This method gets called when a profile gets disconnected.
device | device to be disconnected |
request | request to be used for sending reply |
void BluezQt::Profile::setAutoConnect | ( | bool | autoConnect | ) |
Sets whether the profile is automatically connected.
In case of a client UUID this will force connection of the RFCOMM or L2CAP channels when a remote device is connected.
autoConnect | autoconnect the profile |
void BluezQt::Profile::setChannel | ( | quint16 | channel | ) |
Sets the RFCOMM channel number.
Available channel number range is 0-31. Setting channel number to 0 will automatically choose correct channel number for profile UUID.
channel | channel number |
void BluezQt::Profile::setFeatures | ( | quint16 | features | ) |
Sets the profile features.
features | features of the profile |
void BluezQt::Profile::setLocalRole | ( | LocalRole | role | ) |
Sets the local role to identify side.
For asymmetric profiles that do not have UUIDs available to uniquely identify each side this parameter allows specifying the precise local role.
role | local role |
void BluezQt::Profile::setName | ( | const QString & | name | ) |
Sets the human readable name of the profile.
name | name of the profile |
void BluezQt::Profile::setPsm | ( | quint16 | psm | ) |
Sets the L2CAP port number.
PSM (Protocol Service Multiplexer) is a port number in L2CAP.
Setting PSM to 0 will automatically choose correct PSM for profile UUID.
psm | PSM |
void BluezQt::Profile::setRequireAuthentication | ( | bool | require | ) |
Sets whether the pairing is required to connect.
require | require to pair |
void BluezQt::Profile::setRequireAuthorization | ( | bool | require | ) |
Sets whether the authorization is required to connect.
require | require to authorize |
void BluezQt::Profile::setService | ( | const QString & | service | ) |
Sets the primary service class UUID (if different from profile UUID).
service | service UUID |
void BluezQt::Profile::setServiceRecord | ( | const QString & | serviceRecord | ) |
Sets a SDP record.
This allows to provide a manual SDP record, otherwise it will be generated automatically.
serviceRecord | SDP record |
void BluezQt::Profile::setVersion | ( | quint16 | version | ) |
Sets the profile version.
version | version of the profile |
|
pure virtual |
UUID of the profile.