Change bluetooth server to discoverable mode

This commit is contained in:
Simon Stürz 2018-07-05 14:07:29 +02:00 committed by Michael Zanetti
parent 9419ba0174
commit c2a253b3a2

View File

@ -87,8 +87,7 @@ void BluetoothServer::onHostModeChanged(const QBluetoothLocalDevice::HostMode &m
return; return;
if (mode != QBluetoothLocalDevice::HostDiscoverable || mode != QBluetoothLocalDevice::HostDiscoverableLimitedInquiry) { if (mode != QBluetoothLocalDevice::HostDiscoverable || mode != QBluetoothLocalDevice::HostDiscoverableLimitedInquiry) {
m_localDevice->powerOn(); m_localDevice->setHostMode(QBluetoothLocalDevice::HostDiscoverable);
m_localDevice->setHostMode(QBluetoothLocalDevice::HostDiscoverableLimitedInquiry);
} }
} }
@ -162,7 +161,7 @@ bool BluetoothServer::startServer()
// Init adapter // Init adapter
qCDebug(dcConnection()) << "BluetoothServer: Using adapter" << m_localDevice->name() << m_localDevice->address().toString(); qCDebug(dcConnection()) << "BluetoothServer: Using adapter" << m_localDevice->name() << m_localDevice->address().toString();
m_localDevice->powerOn(); m_localDevice->powerOn();
m_localDevice->setHostMode(QBluetoothLocalDevice::HostDiscoverableLimitedInquiry); m_localDevice->setHostMode(QBluetoothLocalDevice::HostDiscoverable);
connect(m_localDevice, &QBluetoothLocalDevice::hostModeStateChanged, this, &BluetoothServer::onHostModeChanged); connect(m_localDevice, &QBluetoothLocalDevice::hostModeStateChanged, this, &BluetoothServer::onHostModeChanged);
// Init bluetooth server // Init bluetooth server