summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Blasche <alexander.blasche@digia.com>2013-12-16 14:31:31 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-12-20 09:05:28 +0100
commitf661b7fbb19d845b23450c57127020ee86df578d (patch)
tree6a48b01a9822a0752492443e0bc21ae14ebf5d2c
parentf8ff297e7983d2ec15a85ffd4a815b0500ebadb9 (diff)
Improve error reporting.
Whenever we emit an error, we should set the human readable error string in the discovery classes. [ChangeLog][QtBluetooth][Documentation] Fix cases where device and service discovery classes emitted an error signal but the human readable error string was not adjusted. Change-Id: I9680853d17d2ee4bc1293826bb7bf56cc999e2ed Reviewed-by: Fabian Bumberger <fbumberger@rim.com> Reviewed-by: Alex Blasche <alexander.blasche@digia.com>
-rw-r--r--src/bluetooth/qbluetoothdevicediscoveryagent_qnx.cpp4
-rw-r--r--src/bluetooth/qbluetoothservicediscoveryagent.cpp3
2 files changed, 6 insertions, 1 deletions
diff --git a/src/bluetooth/qbluetoothdevicediscoveryagent_qnx.cpp b/src/bluetooth/qbluetoothdevicediscoveryagent_qnx.cpp
index f911a212..f782e364 100644
--- a/src/bluetooth/qbluetoothdevicediscoveryagent_qnx.cpp
+++ b/src/bluetooth/qbluetoothdevicediscoveryagent_qnx.cpp
@@ -97,6 +97,7 @@ void QBluetoothDeviceDiscoveryAgentPrivate::start()
qWarning() << Q_FUNC_INFO << "rdfd - failed to open /pps/services/bluetooth/remote_devices/.all"
<< m_rdfd;
lastError = QBluetoothDeviceDiscoveryAgent::InputOutputError;
+ errorString = "Cannot open remote device socket";
emit q->error(lastError);
stop();
return;
@@ -105,6 +106,7 @@ void QBluetoothDeviceDiscoveryAgentPrivate::start()
if (!m_rdNotifier) {
qWarning() << Q_FUNC_INFO << "failed to connect to m_rdNotifier";
lastError = QBluetoothDeviceDiscoveryAgent::InputOutputError;
+ errorString = "Cannot connect to Bluetooth socket notifier";
emit q->error(lastError);
stop();
return;
@@ -118,6 +120,8 @@ void QBluetoothDeviceDiscoveryAgentPrivate::start()
} else {
qWarning() << "Could not write to control FD";
m_active = false;
+ lastError = QBluetoothDeviceDiscoveryAgent::InputOutputError;
+ errorString = "Cannot start device inquiry";
q->error(QBluetoothDeviceDiscoveryAgent::InputOutputError);
return;
}
diff --git a/src/bluetooth/qbluetoothservicediscoveryagent.cpp b/src/bluetooth/qbluetoothservicediscoveryagent.cpp
index 1bf31245..7880ba20 100644
--- a/src/bluetooth/qbluetoothservicediscoveryagent.cpp
+++ b/src/bluetooth/qbluetoothservicediscoveryagent.cpp
@@ -372,7 +372,7 @@ void QBluetoothServiceDiscoveryAgentPrivate::_q_deviceDiscoveryFinished()
if (deviceDiscoveryAgent->error() != QBluetoothDeviceDiscoveryAgent::NoError) {
//Forward the device discovery error
error = static_cast<QBluetoothServiceDiscoveryAgent::Error>(deviceDiscoveryAgent->error());
-
+ errorString = deviceDiscoveryAgent->errorString();
setDiscoveryState(Inactive);
Q_Q(QBluetoothServiceDiscoveryAgent);
emit q->error(error);
@@ -412,6 +412,7 @@ void QBluetoothServiceDiscoveryAgentPrivate::_q_deviceDiscovered(const QBluetoot
void QBluetoothServiceDiscoveryAgentPrivate::_q_deviceDiscoveryError(QBluetoothDeviceDiscoveryAgent::Error newError)
{
error = static_cast<QBluetoothServiceDiscoveryAgent::Error>(newError);
+ errorString = deviceDiscoveryAgent->errorString();
deviceDiscoveryAgent->stop();
delete deviceDiscoveryAgent;