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

Function connect

Tactility/Source/bluetooth/Bluetooth.cpp:415–434  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

413}
414
415void connect(const std::array<uint8_t, 6>& addr, int profileId) {
416 LOGGER.info("connect(profile={})", profileId);
417 if (profileId == BT_PROFILE_HID_HOST) {
418 hidHostConnect(addr);
419 } else if (profileId == BT_PROFILE_HID_DEVICE) {
420 if (Device* dev = bluetooth_hid_device_get_device()) {
421 bluetooth_hid_device_start(dev, BT_HID_DEVICE_MODE_KEYBOARD);
422 }
423 } else if (profileId == BT_PROFILE_SPP) {
424 if (Device* dev = bluetooth_serial_get_device()) {
425 bluetooth_serial_start(dev);
426 settings::setSppAutoStart(true);
427 }
428 } else if (profileId == BT_PROFILE_MIDI) {
429 if (Device* dev = bluetooth_midi_get_device()) {
430 bluetooth_midi_start(dev);
431 settings::setMidiAutoStart(true);
432 }
433 }
434}
435
436void disconnect(const std::array<uint8_t, 6>& addr, int profileId) {
437 LOGGER.info("disconnect(profile={})", profileId);

Callers 6

onConnectFunction · 0.50
onConnectPeerFunction · 0.50
onPressConnectMethod · 0.50
onConnectFunction · 0.50
onPressConnectMethod · 0.50
tt_wifi_connectFunction · 0.50

Calls 10

bluetooth_serial_startFunction · 0.85
setSppAutoStartFunction · 0.85
bluetooth_midi_startFunction · 0.85
setMidiAutoStartFunction · 0.85
infoMethod · 0.80
hidHostConnectFunction · 0.70

Tested by

no test coverage detected