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>
This commit is contained in:
Claudiu Olteanu 2015-07-18 20:54:31 +03:00 committed by Dirk Hohndel
parent 0cf5214c15
commit 5ccf3e81eb
2 changed files with 22 additions and 0 deletions

View file

@ -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)));
}

View file

@ -37,6 +37,7 @@ private slots:
void displayPairingMenu(const QPoint &pos);
void pairingFinished(const QBluetoothAddress &address,QBluetoothLocalDevice::Pairing pairing);
void error(QBluetoothLocalDevice::Error error);
void deviceDiscoveryError(QBluetoothDeviceDiscoveryAgent::Error error);
void localDeviceChanged(int);
private: