QBluetoothTransferManager Class

The QBluetoothTransferManager class transfers data to another device using Object Push Profile (OPP). More...

Header: #include <QBluetoothTransferManager>
qmake: QT += bluetooth
Since: Qt 5.2
Inherits: QObject

Public Functions

QBluetoothTransferManager(QObject *parent = nullptr)
virtual ~QBluetoothTransferManager()
QBluetoothTransferReply *put(const QBluetoothTransferRequest &request, QIODevice *data)
  • 34 public functions inherited from QObject


void finished(QBluetoothTransferReply *reply)

Additional Inherited Members

  • 1 property inherited from QObject
  • 1 public slot inherited from QObject
  • 1 public variable inherited from QObject
  • 10 static public members inherited from QObject
  • 9 protected functions inherited from QObject
  • 2 protected variables inherited from QObject

Detailed Description

The QBluetoothTransferManager class transfers data to another device using Object Push Profile (OPP).

QBluetoothTransferManager uses OBEX to send put commands to remote devices. A typical OBEX transfer is initialized as follows:

// Create a transfer manager
QBluetoothTransferManager *transferManager = new QBluetoothTransferManager(this);

// Create the transfer request and file to be sent
QBluetoothAddress remoteAddress("00:11:22:33:44:55:66");
QBluetoothTransferRequest request(remoteAddress);
QFile *file = new QFile("testfile.txt");

// Ask the transfer manager to send it
QBluetoothTransferReply *reply = transferManager->put(request, file);
if (reply->error() == QBluetoothTransferReply::NoError) {

    // Connect to the reply's signals to be informed about the status and do cleanups when done
    QObject::connect(reply, SIGNAL(finished(QBluetoothTransferReply*)),
                     this, SLOT(transferFinished(QBluetoothTransferReply*)));
    QObject::connect(reply, SIGNAL(error(QBluetoothTransferReply::TransferError)),
                     this, SLOT(error(QBluetoothTransferReply::TransferError)));
} else {
    qWarning() << "Cannot push testfile.txt:" << reply->errorString();

Note that this API is not currently supported on Android.

Member Function Documentation

QBluetoothTransferManager::QBluetoothTransferManager(QObject *parent = nullptr)

Constructs a new QBluetoothTransferManager with parent.

[virtual] QBluetoothTransferManager::~QBluetoothTransferManager()

Destroys the QBluetoothTransferManager.

[signal] void QBluetoothTransferManager::finished(QBluetoothTransferReply *reply)

This signal is emitted when the transfer for reply finishes.

QBluetoothTransferReply *QBluetoothTransferManager::put(const QBluetoothTransferRequest &request, QIODevice *data)

Sends the contents of data to the remote device identified by request, and returns a new QBluetoothTransferReply that can be used to track the request's progress. data must remain valid until the finished() signal is emitted.

The returned QBluetoothTransferReply object must be immediately checked for its error() state. This is required in case this function detects an error during the initialization of the QBluetoothTransferReply. In such cases QBluetoothTransferReply::isFinished() returns true as well.

If the platform does not support the Object Push profile, this function will return 0.

© 2019 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.