summaryrefslogtreecommitdiffstats
path: root/src/imports
diff options
context:
space:
mode:
authorFabian Bumberger <fbumberger@rim.com>2013-09-18 16:16:12 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-09-18 17:24:43 +0200
commite071e7157797caf99a8cac990fc4066fcb6589ca (patch)
tree0e6e16ec650e607c7f8d5944c43a0dd922e58a47 /src/imports
parent9fa7195f0f2b8e7148215df564240dbfdad34935 (diff)
Add remote address property to QBluetoothDiscoveryModel
Change-Id: I979eaa15d62606206c4c175dcdcaf9d1691f4117 Reviewed-by: Alex Blasche <alexander.blasche@digia.com>
Diffstat (limited to 'src/imports')
-rw-r--r--src/imports/bluetooth/qdeclarativebluetoothdiscoverymodel.cpp26
-rw-r--r--src/imports/bluetooth/qdeclarativebluetoothdiscoverymodel_p.h5
2 files changed, 31 insertions, 0 deletions
diff --git a/src/imports/bluetooth/qdeclarativebluetoothdiscoverymodel.cpp b/src/imports/bluetooth/qdeclarativebluetoothdiscoverymodel.cpp
index b3077073..47ea4b6d 100644
--- a/src/imports/bluetooth/qdeclarativebluetoothdiscoverymodel.cpp
+++ b/src/imports/bluetooth/qdeclarativebluetoothdiscoverymodel.cpp
@@ -105,6 +105,7 @@ public:
bool m_running;
bool m_runningRequested;
bool m_componentCompleted;
+ QString m_remoteAddress;
};
QDeclarativeBluetoothDiscoveryModel::QDeclarativeBluetoothDiscoveryModel(QObject *parent) :
@@ -397,6 +398,8 @@ void QDeclarativeBluetoothDiscoveryModel::setRunning(bool running)
connect(d->m_serviceAgent, SIGNAL(error(QBluetoothServiceDiscoveryAgent::Error)), this, SLOT(errorDiscovery(QBluetoothServiceDiscoveryAgent::Error)));
}
+ d->m_serviceAgent->setRemoteAddress(QBluetoothAddress(d->m_remoteAddress));
+
if (!d->m_uuid.isEmpty())
d->m_serviceAgent->setUuidFilter(QBluetoothUuid(d->m_uuid));
@@ -443,3 +446,26 @@ void QDeclarativeBluetoothDiscoveryModel::setUuidFilter(QString uuid)
d->m_uuid = uuid;
emit uuidFilterChanged();
}
+
+/*!
+ \qmlproperty string BluetoothDiscoveryModel::remoteAddress
+
+ This property holds an optional bluetooth address for a remote bluetooth device.
+ Only services on this remote device will be discovered. It has no effect if
+ an invalid bluetooth address was set or if the property was set after the discovery
+ was started.
+
+ The property is ignored if device discovery is selected.
+
+*/
+
+QString QDeclarativeBluetoothDiscoveryModel::remoteAddress()
+{
+ return d->m_remoteAddress;
+}
+
+void QDeclarativeBluetoothDiscoveryModel::setRemoteAddress(QString address)
+{
+ d->m_remoteAddress = address;
+ Q_EMIT remoteAddressChanged();
+}
diff --git a/src/imports/bluetooth/qdeclarativebluetoothdiscoverymodel_p.h b/src/imports/bluetooth/qdeclarativebluetoothdiscoverymodel_p.h
index 725f98bf..a675f1ce 100644
--- a/src/imports/bluetooth/qdeclarativebluetoothdiscoverymodel_p.h
+++ b/src/imports/bluetooth/qdeclarativebluetoothdiscoverymodel_p.h
@@ -67,6 +67,7 @@ class QDeclarativeBluetoothDiscoveryModel : public QAbstractListModel, public QQ
Q_PROPERTY(DiscoveryMode discoveryMode READ discoveryMode WRITE setDiscoveryMode NOTIFY discoveryModeChanged)
Q_PROPERTY(bool running READ running WRITE setRunning NOTIFY runningChanged)
Q_PROPERTY(QString uuidFilter READ uuidFilter WRITE setUuidFilter NOTIFY uuidFilterChanged)
+ Q_PROPERTY(QString remoteAddress READ remoteAddress WRITE setRemoteAddress NOTIFY remoteAddressChanged)
Q_INTERFACES(QQmlParserStatus)
public:
explicit QDeclarativeBluetoothDiscoveryModel(QObject *parent = 0);
@@ -113,6 +114,9 @@ public:
QString uuidFilter() const;
void setUuidFilter(QString uuid);
+ QString remoteAddress();
+ void setRemoteAddress(QString);
+
signals:
void errorChanged();
void discoveryModeChanged();
@@ -120,6 +124,7 @@ signals:
void newDeviceDiscovered();
void runningChanged();
void uuidFilterChanged();
+ void remoteAddressChanged();
private slots:
void serviceDiscovered(const QBluetoothServiceInfo &service);