MCPcopy Create free account
hub / github.com/TactilityProject/Tactility / start

Function start

Tactility/Source/bluetooth/Bluetooth.cpp:270–295  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

268}
269
270bool start(Device* dev) {
271 LOGGER.info("Auto-enabling BLE on boot");
272 if (!device_is_ready(dev)) {
273 LOGGER.info("Starting BLE device");
274 if (device_start(dev) != ERROR_NONE) {
275 LOGGER.error("Failed to start BLE device");
276 return false;
277 }
278 }
279
280 // TODO: Fix bug where repeatedly calling start would add this callback multiple times
281 if (bluetooth_add_event_callback(dev, nullptr, bt_event_bridge) != ERROR_NONE) {
282 LOGGER.error("Failed to set BLE callback");
283 }
284
285 LOGGER.info("Enabling BT radio");
286 if (bluetooth_set_radio_enabled(dev, true) != ERROR_NONE) {
287 LOGGER.error("Failed to enable BLE radio");
288 // Add bridge again
289 bluetooth_remove_event_callback(dev, bt_event_bridge);
290 return false;
291 }
292
293 LOGGER.info("BT enabled");
294 return true;
295}
296
297bool stop(Device* dev) {
298 BtRadioState state;

Callers 1

systemStartFunction · 0.70

Calls 7

device_is_readyFunction · 0.85
device_startFunction · 0.85
infoMethod · 0.80
errorMethod · 0.80

Tested by

no test coverage detected