| 434 | } |
| 435 | |
| 436 | void disconnect(const std::array<uint8_t, 6>& addr, int profileId) { |
| 437 | LOGGER.info("disconnect(profile={})", profileId); |
| 438 | if (profileId == BT_PROFILE_HID_HOST) { |
| 439 | hidHostDisconnect(); |
| 440 | } else if (profileId == BT_PROFILE_HID_DEVICE) { |
| 441 | if (Device* dev = bluetooth_hid_device_get_device()) { |
| 442 | bluetooth_hid_device_stop(dev); |
| 443 | } |
| 444 | } else { |
| 445 | Device* dev = device_find_first_active_by_type(&BLUETOOTH_TYPE); |
| 446 | if (dev == nullptr) return; |
| 447 | bluetooth_disconnect(dev, addr.data(), (BtProfileId)profileId); |
| 448 | } |
| 449 | } |
| 450 | |
| 451 | bool isProfileSupported(int profileId) { |
| 452 | return profileId == BT_PROFILE_HID_HOST || |
no test coverage detected