summaryrefslogtreecommitdiffstats
path: root/src/bluetooth/qbluetoothservicediscoveryagent.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/bluetooth/qbluetoothservicediscoveryagent.cpp')
-rw-r--r--src/bluetooth/qbluetoothservicediscoveryagent.cpp42
1 files changed, 34 insertions, 8 deletions
diff --git a/src/bluetooth/qbluetoothservicediscoveryagent.cpp b/src/bluetooth/qbluetoothservicediscoveryagent.cpp
index 136ec8e5..89149941 100644
--- a/src/bluetooth/qbluetoothservicediscoveryagent.cpp
+++ b/src/bluetooth/qbluetoothservicediscoveryagent.cpp
@@ -119,18 +119,14 @@ QBluetoothServiceDiscoveryAgent::QBluetoothServiceDiscoveryAgent(QObject *parent
}
/*!
- Constructs a new QBluetoothServiceDiscoveryAgent for \a remoteAddress and with \a parent.
+ Constructs a new QBluetoothServiceDiscoveryAgent for \a deviceAdapter and with \a parent.
- If \a remoteAddress is null, services will be discovred on all contactable Bluetooth
- devices.
+ If \a deviceAdapter is null, the default adapter will be used.
*/
-QBluetoothServiceDiscoveryAgent::QBluetoothServiceDiscoveryAgent(const QBluetoothAddress &remoteAddress, QObject *parent)
-: QObject(parent), d_ptr(new QBluetoothServiceDiscoveryAgentPrivate(remoteAddress))
+QBluetoothServiceDiscoveryAgent::QBluetoothServiceDiscoveryAgent(const QBluetoothAddress &deviceAdapter, QObject *parent)
+: QObject(parent), d_ptr(new QBluetoothServiceDiscoveryAgentPrivate(deviceAdapter))
{
d_ptr->q_ptr = this;
- if (!remoteAddress.isNull()) {
- d_ptr->singleDevice = true;
- }
}
/*!
@@ -196,6 +192,36 @@ QList<QBluetoothUuid> QBluetoothServiceDiscoveryAgent::uuidFilter() const
}
/*!
+ Sets remote device address to \a address. If \a address is null, services will be discovered
+ on all contactable Bluetooth devices. A new remote address can only be set while there is
+ no service discovery in progress; otherwise this function returns false.
+
+*/
+bool QBluetoothServiceDiscoveryAgent::setRemoteAddress(const QBluetoothAddress &address)
+{
+ if (isActive())
+ return false;
+ if (!address.isNull())
+ d_ptr->singleDevice = true;
+ d_ptr->deviceAddress = address;
+
+ return true;
+}
+
+/*!
+ Returns the remote device address. If setRemoteAddress is not called, the function
+ will return default QBluetoothAddress.
+
+*/
+QBluetoothAddress QBluetoothServiceDiscoveryAgent::remoteAddress() const
+{
+ if (d_ptr->singleDevice == true)
+ return d_ptr->deviceAddress;
+ else
+ return QBluetoothAddress();
+}
+
+/*!
Starts service discovery. \a mode specifies the type of service discovery to perform.
On Blackberry devices device discovery may lead to pairing requests.