| 413 | } |
| 414 | |
| 415 | void 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 | |
| 436 | void disconnect(const std::array<uint8_t, 6>& addr, int profileId) { |
| 437 | LOGGER.info("disconnect(profile={})", profileId); |
no test coverage detected