QBluetoothDeviceDiscoveryAgent
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.
QtConnectivity
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())); 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.
Overview
Public Types Index
enum ErrorNoError, IOFailure, PoweredOff, UnknownError 100 | |
enum InquiryType |
Properties Index
Public Functions Index
QBluetoothDeviceDiscoveryAgent (QObject *parent=0) | |
~QBluetoothDeviceDiscoveryAgent () | |
QList< QBluetoothDeviceInfo > | discoveredDevices () const |
Error | error () const |
QString | errorString () const |
QBluetoothDeviceDiscoveryAgent::InquiryType | inquiryType () const |
bool | isActive () const |
void | setInquiryType (QBluetoothDeviceDiscoveryAgent::InquiryType type) |
Signals Index
void | canceled () |
void | deviceDiscovered (const QBluetoothDeviceInfo &info) |
void | error (QBluetoothDeviceDiscoveryAgent::Error error) |
void | finished () |
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.
- NoError
- IOFailure
- PoweredOff
- 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
- GeneralUnlimitedInquiry
- LimitedInquiry
Properties
QBluetoothDeviceDiscoveryAgent::InquiryType
type of inquiry scan to use when discovering devices
Public Functions
Constructs a new Bluetooth device discovery agent with parent parent.
Destructor.
QList< QBluetoothDeviceInfo >
Returns a list of all discovered Bluetooth devices.
Error
Returns the last error which has occurred.
QString
Returns a human-readable description of the last error that occurred.
bool
Returns true if the agent is currently discovering Bluetooth devices, other returns false.
void
Public Slots
void
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.
Signals
void
This signal is emitted when device discovery is aborted by a call to stop().
void
This signal is emitted when the Bluetooth device described by info is discovered.
void
This signal is emitted when an error occurs during Bluetooth device discovery.
void
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.
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide. All other trademarks are property of their respective owners. Privacy Policy