mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-28 05:00:20 +00:00
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:
parent
0cf5214c15
commit
5ccf3e81eb
2 changed files with 22 additions and 0 deletions
|
@ -276,6 +276,25 @@ void BtDeviceSelectionDialog::error(QBluetoothLocalDevice::Error error)
|
||||||
.arg((error == QBluetoothLocalDevice::PairingError)? "Pairing error" : "Unknown 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()
|
QString BtDeviceSelectionDialog::getSelectedDeviceAddress()
|
||||||
{
|
{
|
||||||
if (selectedRemoteDeviceInfo) {
|
if (selectedRemoteDeviceInfo) {
|
||||||
|
@ -336,4 +355,6 @@ void BtDeviceSelectionDialog::initializeDeviceDiscoveryAgent()
|
||||||
this, SLOT(addRemoteDevice(QBluetoothDeviceInfo)));
|
this, SLOT(addRemoteDevice(QBluetoothDeviceInfo)));
|
||||||
connect(remoteDeviceDiscoveryAgent, SIGNAL(finished()),
|
connect(remoteDeviceDiscoveryAgent, SIGNAL(finished()),
|
||||||
this, SLOT(remoteDeviceScanFinished()));
|
this, SLOT(remoteDeviceScanFinished()));
|
||||||
|
connect(remoteDeviceDiscoveryAgent, SIGNAL(error(QBluetoothDeviceDiscoveryAgent::Error)),
|
||||||
|
this, SLOT(deviceDiscoveryError(QBluetoothDeviceDiscoveryAgent::Error)));
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,6 +37,7 @@ private slots:
|
||||||
void displayPairingMenu(const QPoint &pos);
|
void displayPairingMenu(const QPoint &pos);
|
||||||
void pairingFinished(const QBluetoothAddress &address,QBluetoothLocalDevice::Pairing pairing);
|
void pairingFinished(const QBluetoothAddress &address,QBluetoothLocalDevice::Pairing pairing);
|
||||||
void error(QBluetoothLocalDevice::Error error);
|
void error(QBluetoothLocalDevice::Error error);
|
||||||
|
void deviceDiscoveryError(QBluetoothDeviceDiscoveryAgent::Error error);
|
||||||
void localDeviceChanged(int);
|
void localDeviceChanged(int);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
Loading…
Reference in a new issue