diff options
author | Claudiu Olteanu <olteanu.claudiu@ymail.com> | 2015-07-18 20:54:31 +0300 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2015-07-20 05:39:43 -0700 |
commit | 5ccf3e81eb3a0254a1f85fcbd9bd4c6ea3addcb1 (patch) | |
tree | f27cea552da40e0cc3f73f2482d9c09309077524 /qt-ui/btdeviceselectiondialog.cpp | |
parent | 0cf5214c15709844a2b79a7cee029ef93cb76e73 (diff) | |
download | subsurface-5ccf3e81eb3a0254a1f85fcbd9bd4c6ea3addcb1.tar.gz |
Log errors which occur during Bluetooth device discovery
Register to the signal emmited when an error occurs during
Bluetooth device discovery and log a description of the
error which can be used to identify problem's cause.
Signed-off-by: Claudiu Olteanu <olteanu.claudiu@ymail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/btdeviceselectiondialog.cpp')
-rw-r--r-- | qt-ui/btdeviceselectiondialog.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/qt-ui/btdeviceselectiondialog.cpp b/qt-ui/btdeviceselectiondialog.cpp index 2f5a5d1f9..e52580e78 100644 --- a/qt-ui/btdeviceselectiondialog.cpp +++ b/qt-ui/btdeviceselectiondialog.cpp @@ -276,6 +276,25 @@ void BtDeviceSelectionDialog::error(QBluetoothLocalDevice::Error error) .arg((error == QBluetoothLocalDevice::PairingError)? "Pairing error" : "Unknown error")); } +void BtDeviceSelectionDialog::deviceDiscoveryError(QBluetoothDeviceDiscoveryAgent::Error error) +{ + QString errorDescription; + + switch (error) { + case QBluetoothDeviceDiscoveryAgent::PoweredOffError: + errorDescription = QString("The Bluetooth adaptor is powered off, power it on before doing discovery."); + break; + case QBluetoothDeviceDiscoveryAgent::InputOutputError: + errorDescription = QString("Writing or reading from the device resulted in an error."); + break; + default: + errorDescription = QString("An unknown error has occurred."); + break; + } + + ui->dialogStatus->setText(QString("Device discovery error: %1.").arg(errorDescription)); +} + QString BtDeviceSelectionDialog::getSelectedDeviceAddress() { if (selectedRemoteDeviceInfo) { @@ -336,4 +355,6 @@ void BtDeviceSelectionDialog::initializeDeviceDiscoveryAgent() this, SLOT(addRemoteDevice(QBluetoothDeviceInfo))); connect(remoteDeviceDiscoveryAgent, SIGNAL(finished()), this, SLOT(remoteDeviceScanFinished())); + connect(remoteDeviceDiscoveryAgent, SIGNAL(error(QBluetoothDeviceDiscoveryAgent::Error)), + this, SLOT(deviceDiscoveryError(QBluetoothDeviceDiscoveryAgent::Error))); } |