MCPcopy Create free account
hub / github.com/Serial-Studio/Serial-Studio / onHostModeStateChanged

Method onHostModeStateChanged

app/src/IO/Drivers/BluetoothLE.cpp:1333–1356  ·  view source on GitHub ↗

* @brief Static callback -- handles Bluetooth adapter power state changes. */

Source from the content-addressed store, hash-verified

1331 * @brief Static callback -- handles Bluetooth adapter power state changes.
1332 */
1333void IO::Drivers::BluetoothLE::onHostModeStateChanged(QBluetoothLocalDevice::HostMode state)
1334{
1335 bool wasAvailable = s_adapterAvailable;
1336 s_adapterAvailable = (state != QBluetoothLocalDevice::HostPoweredOff);
1337
1338 if (wasAvailable == s_adapterAvailable)
1339 return;
1340
1341 for (auto* inst : std::as_const(s_instances))
1342 Q_EMIT inst->adapterAvailabilityChanged();
1343
1344 if (!s_adapterAvailable) {
1345 if (s_discoveryAgent && s_discoveryAgent->isActive())
1346 s_discoveryAgent->stop();
1347
1348 s_devices.clear();
1349 s_deviceNames.clear();
1350 for (auto* inst : std::as_const(s_instances)) {
1351 inst->close();
1352 inst->m_deviceIndex = -1;
1353 Q_EMIT inst->devicesChanged();
1354 }
1355 }
1356}
1357
1358//--------------------------------------------------------------------------------------------------
1359// Stable device identification

Callers

nothing calls this directly

Calls 4

isActiveMethod · 0.45
stopMethod · 0.45
clearMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected