Since: 1.2

#include <QtConnectivity/QBluetoothDeviceDiscoveryAgent>

More information will be added here shortly. For now, you'll find more extensive information about this class in the Qt reference for QBluetoothDeviceDiscoveryAgent

The QBluetoothDeviceDiscoveryAgent class provides an API for discovering nearby Bluetooth devices.


To discovery nearby Bluetooth devices create an instance of QBluetoothDeviceDiscoveryAgent, connect to either the deviceDiscovered() or finished() signals and call start().

    QBluetoothDeviceDiscoveryAgent *discoveryAgent = new QBluetoothDeviceDiscoveryAgent(this);

    connect(discoveryAgent, SIGNAL(deviceDiscovered(const QBluetoothDeviceInfo&)),
            this, SLOT(deviceDiscovered(const QBluetoothDeviceInfo&)));

    // Automatically delete agent when device discovery finishes.
    connect(discoveryAgent, SIGNAL(finished()), this, SLOT(deleteLater()));

To retrieve results asynchronously connect to the deviceDiscovered() signal. To get a list of all discovered devices call discoveredDevices() after the finished() signal is emitted.


Public Types Index

Public Functions Index

QBluetoothDeviceDiscoveryAgent (QObject *parent=0)
~QBluetoothDeviceDiscoveryAgent ()
QList< QBluetoothDeviceInfo >discoveredDevices () const
Errorerror () const
QStringerrorString () const
QBluetoothDeviceDiscoveryAgent::InquiryTypeinquiryType () const
boolisActive () const
voidsetInquiryType (QBluetoothDeviceDiscoveryAgent::InquiryType type)

Public Slots Index

voidstart ()
voidstop ()

Signals Index

voidcanceled ()
voiddeviceDiscovered (const QBluetoothDeviceInfo &info)
voiderror (QBluetoothDeviceDiscoveryAgent::Error error)
voidfinished ()

Public Types


Indicates all possible error conditions found during Bluetooth device discovery.

NoError No error has occurred. PoweredOff Bluetooth adaptor is powered off, power it on before doing discovery. IOFailure Writing or reading from device resulted in an error. UnknownError An unknown error has occurred.

UnknownError 100


This enum describes the inquiry type used when discovering Bluetooth devices.

GeneralUnlimitedInquiry A general unlimited inquiry. Discovers all visible Bluetooth devices in the local vicinity. LimitedInquiry A limited inquiry. Only discovers devices that are in limited inquiry mode. Not all platforms support limited inquiry. If limited inquiry is requested on a platform that does not support it general unlimited inquiry we be used instead. Setting LimitedInquiry is useful for 2 games that wish to find each other quickly. The phone scans for devices in LimitedInquiry and Service Discovery is only done on one or two devices speeding up the service scan. After the game has connected the device returns to GeneralUnilimitedInquiry



QBluetoothDeviceDiscoveryAgent::InquiryType inquiryType

type of inquiry scan to use when discovering devices

See also:


Public Functions

QBluetoothDeviceDiscoveryAgent (

Constructs a new Bluetooth device discovery agent with parent parent.

~QBluetoothDeviceDiscoveryAgent ()


QList< QBluetoothDeviceInfo > discoveredDevices ()

Returns a list of all discovered Bluetooth devices.

Error error ()

Returns the last error which has occurred.

QString errorString ()

Returns a human-readable description of the last error that occurred.

bool isActive ()

Returns true if the agent is currently discovering Bluetooth devices, other returns false.

Public Slots

void start ()

Starts Bluetooth device discovery, if it is not already started.

The deviceDiscovered() signal is emitted as each device is discovered. The finished() signal is emitted once device discovery is complete.

void stop ()

Stops Bluetooth device discovery.

The cancel() signal is emitted once the device discovery is canceled. start() maybe called before the cancel signal is received. Once start() has been called the cancel signal from the prior discovery will be silently discarded.


void canceled ()

This signal is emitted when device discovery is aborted by a call to stop().

void deviceDiscovered (

This signal is emitted when the Bluetooth device described by info is discovered.

void error (

This signal is emitted when an error occurs during Bluetooth device discovery.

void finished ()

This signal is emitted when Bluetooth device discovery completes.

Last modified: 2015-03-26

Got questions about leaving a comment? Get answers from our Disqus FAQ.

comments powered by Disqus