The QBluetoothDeviceDiscoveryAgent class provides an API for discovering nearby Bluetooth devices.
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())); discoveryAgent->start();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)|
|QList< QBluetoothDeviceInfo >||discoveredDevices () const|
|Error||error () const|
|QString||errorString () const|
|QBluetoothDeviceDiscoveryAgent::InquiryType||inquiryType () const|
|bool||isActive () const|
|void||setInquiryType (QBluetoothDeviceDiscoveryAgent::InquiryType type)|
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
Constructs a new Bluetooth device discovery agent with parent parent.
Returns the last error which has occurred.
Returns a human-readable description of the last error that occurred.
Returns true if the agent is currently discovering Bluetooth devices, other returns false.
Starts Bluetooth device discovery, if it is not already started.
This signal is emitted when device discovery is aborted by a call to stop().
This signal is emitted when the Bluetooth device described by info is discovered.
This signal is emitted when an error occurs during Bluetooth device discovery.
This signal is emitted when Bluetooth device discovery completes.
© 2013 Digia Plc and/or its subsidiaries. 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.
Documentation sources may be obtained from www.qt-project.org.