Change bluetooth server to discoverable mode
This commit is contained in:
parent
9419ba0174
commit
c2a253b3a2
@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user