summaryrefslogtreecommitdiffstats
path: root/src/bluetooth/qbluetoothdevicediscoveryagent_win.cpp
diff options
context:
space:
mode:
authorDavid Weisgerber <weisgerber@ms-gmbh.de>2014-08-22 13:28:19 +0200
committerAlex Blasche <alexander.blasche@digia.com>2014-09-01 08:34:43 +0200
commit4fc7f500adbb4316a0f92424364876ec714eeb8e (patch)
treefde77e6742a53cde0a455cb5e397f3e87d54c83e /src/bluetooth/qbluetoothdevicediscoveryagent_win.cpp
parentfc4ed403dc20507d3c3f137b4acb957e2eef3c41 (diff)
Moved Q_DECLARE_METATYPE outside of Qt namespace
Added test if bluetooth device present in start sequence of device discovery Change-Id: I87db065a38bc5cb8e8acb603d48e5856d3bc7080 Reviewed-by: Alex Blasche <alexander.blasche@digia.com>
Diffstat (limited to 'src/bluetooth/qbluetoothdevicediscoveryagent_win.cpp')
-rw-r--r--src/bluetooth/qbluetoothdevicediscoveryagent_win.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/bluetooth/qbluetoothdevicediscoveryagent_win.cpp b/src/bluetooth/qbluetoothdevicediscoveryagent_win.cpp
index 94c62ba1..bdfb0237 100644
--- a/src/bluetooth/qbluetoothdevicediscoveryagent_win.cpp
+++ b/src/bluetooth/qbluetoothdevicediscoveryagent_win.cpp
@@ -57,7 +57,6 @@ struct NativeFindResult
HBLUETOOTH_DEVICE_FIND findHandle;
DWORD errorCode;
};
-Q_DECLARE_METATYPE(NativeFindResult)
NativeFindResult::NativeFindResult()
: findHandle(NULL)
@@ -109,6 +108,13 @@ void QBluetoothDeviceDiscoveryAgentPrivate::start()
discoveredDevices.clear();
+ if (isValid() == false) {
+ lastError = QBluetoothDeviceDiscoveryAgent::InvalidBluetoothAdapterError;
+ errorString = qt_error_string(ERROR_INVALID_HANDLE);
+ emit q->error(lastError);
+ return;
+ }
+
if (!findWatcher) {
findWatcher = new QFutureWatcher<QVariant>(q);
QObject::connect(findWatcher, SIGNAL(finished()), q, SLOT(_q_handleFindResult()));
@@ -241,3 +247,5 @@ void QBluetoothDeviceDiscoveryAgentPrivate::findClose(HBLUETOOTH_DEVICE_FIND fin
}
QT_END_NAMESPACE
+
+Q_DECLARE_METATYPE(QT_PREPEND_NAMESPACE(NativeFindResult))