feat(ble): Add function to get profile address by index (#2992)

This commit is contained in:
snoyer 2025-07-10 06:25:11 +04:00 committed by GitHub
parent e93cd31a58
commit 9e905d6593
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 8 additions and 0 deletions

View File

@ -28,6 +28,7 @@ int zmk_ble_prof_disconnect(uint8_t index);
int zmk_ble_active_profile_index(void);
int zmk_ble_profile_index(const bt_addr_le_t *addr);
bt_addr_le_t *zmk_ble_profile_address(uint8_t index);
bt_addr_le_t *zmk_ble_active_profile_addr(void);
struct bt_conn *zmk_ble_active_profile_conn(void);

View File

@ -250,6 +250,13 @@ int zmk_ble_profile_index(const bt_addr_le_t *addr) {
return -ENODEV;
}
bt_addr_le_t *zmk_ble_profile_address(uint8_t index) {
if (index >= ZMK_BLE_PROFILE_COUNT) {
return (bt_addr_le_t *)(BT_ADDR_LE_NONE);
}
return &profiles[index].peer;
}
#if IS_ENABLED(CONFIG_SETTINGS)
static void ble_save_profile_work(struct k_work *work) {
settings_save_one("ble/active_profile", &active_profile, sizeof(active_profile));