restart the server when needed

This commit is contained in:
Michael Zanetti 2018-09-12 17:39:13 +02:00
parent 860de4870b
commit 1bac0c4723

View File

@ -215,6 +215,8 @@ void BluetoothServer::onHostModeStateChanged(const QBluetoothLocalDevice::HostMo
break; break;
case QBluetoothLocalDevice::HostPoweredOff: case QBluetoothLocalDevice::HostPoweredOff:
qCDebug(dcBluetoothServer()) << "Bluetooth host in power off mode."; qCDebug(dcBluetoothServer()) << "Bluetooth host in power off mode.";
stop();
start();
break; break;
case QBluetoothLocalDevice::HostDiscoverableLimitedInquiry: case QBluetoothLocalDevice::HostDiscoverableLimitedInquiry:
qCDebug(dcBluetoothServer()) << "Bluetooth host in discoverable limited inquiry mode."; qCDebug(dcBluetoothServer()) << "Bluetooth host in discoverable limited inquiry mode.";
@ -237,6 +239,8 @@ void BluetoothServer::onDeviceDisconnected(const QBluetoothAddress &address)
void BluetoothServer::onError(const QLowEnergyController::Error &error) void BluetoothServer::onError(const QLowEnergyController::Error &error)
{ {
qCWarning(dcBluetoothServer()) << "Bluetooth error occured:" << error << m_controller->errorString(); qCWarning(dcBluetoothServer()) << "Bluetooth error occured:" << error << m_controller->errorString();
stop();
start();
} }
void BluetoothServer::onConnected() void BluetoothServer::onConnected()