MCPcopy Create free account
hub / github.com/BruceDevices/firmware / stopBLEStack

Function stopBLEStack

src/modules/ble/ble_common.cpp:93–122  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

91static bool is_ble_inited = false;
92
93void stopBLEStack() {
94 if (pBLEScan) pBLEScan->stop();
95
96#if !defined(LITE_VERSION)
97 if (BLEStateManager::isBLEActive() || BLEStateManager::getActiveClientCount() > 0) {
98 BLEStateManager::deinitBLE(true);
99 } else
100#endif
101 if (BLEDevice::getScan() != nullptr || BLEDevice::getAdvertising() != nullptr ||
102 BLEDevice::getServer() != nullptr || BLEConnected || is_ble_inited) {
103 BLEDevice::deinit();
104 }
105
106 pBLEScan = nullptr;
107 pServer = nullptr;
108 pService = nullptr;
109 pTxCharacteristic = nullptr;
110 pRxCharacteristic = nullptr;
111 deviceConnected = false;
112 oldDeviceConnected = false;
113 bleDataTransferEnabled = false;
114 is_ble_inited = false;
115 BLEConnected = false;
116#if !defined(LITE_VERSION)
117 if (hid_ble) {
118 delete hid_ble;
119 hid_ble = nullptr;
120 }
121#endif
122}
123
124void ble_scan_setup() {
125 if (FORCE_RADIO_TEARDOWN_ON_SWITCH) {

Callers 5

ble_scan_setupFunction · 0.85
_connectToWifiNetworkFunction · 0.85
wifiConnectMenuFunction · 0.85
wifiConnectTaskFunction · 0.85
wifiConnecttoKnownNetFunction · 0.85

Calls 1

stopMethod · 0.45

Tested by

no test coverage detected