forked from kofal.net/zmk
feat(ble): Add function to get profile address by index (#2992)
This commit is contained in:
@@ -28,6 +28,7 @@ int zmk_ble_prof_disconnect(uint8_t index);
|
|||||||
|
|
||||||
int zmk_ble_active_profile_index(void);
|
int zmk_ble_active_profile_index(void);
|
||||||
int zmk_ble_profile_index(const bt_addr_le_t *addr);
|
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);
|
bt_addr_le_t *zmk_ble_active_profile_addr(void);
|
||||||
struct bt_conn *zmk_ble_active_profile_conn(void);
|
struct bt_conn *zmk_ble_active_profile_conn(void);
|
||||||
|
|||||||
@@ -250,6 +250,13 @@ int zmk_ble_profile_index(const bt_addr_le_t *addr) {
|
|||||||
return -ENODEV;
|
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)
|
#if IS_ENABLED(CONFIG_SETTINGS)
|
||||||
static void ble_save_profile_work(struct k_work *work) {
|
static void ble_save_profile_work(struct k_work *work) {
|
||||||
settings_save_one("ble/active_profile", &active_profile, sizeof(active_profile));
|
settings_save_one("ble/active_profile", &active_profile, sizeof(active_profile));
|
||||||
|
|||||||
Reference in New Issue
Block a user