mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-03-30 16:20:24 +00:00
gap: add link key iterator functions
This commit is contained in:
parent
92369ee052
commit
1b6fb31be8
25
src/gap.h
25
src/gap.h
@ -44,6 +44,7 @@ extern "C" {
|
||||
|
||||
#include "btstack_defines.h"
|
||||
#include "btstack_util.h"
|
||||
#include "classic/btstack_link_key_db.h"
|
||||
|
||||
typedef enum {
|
||||
|
||||
@ -425,6 +426,30 @@ void gap_drop_link_key_for_bd_addr(bd_addr_t addr);
|
||||
*/
|
||||
void gap_store_link_key_for_bd_addr(bd_addr_t addr, link_key_t link_key, link_key_type_t type);
|
||||
|
||||
/**
|
||||
* @brief Setup Link Key iterator
|
||||
* @param it
|
||||
* @returns 1 on success
|
||||
*/
|
||||
int gap_link_key_iterator_init(btstack_link_key_iterator_t * it);
|
||||
|
||||
/**
|
||||
* @brief Get next Link Key
|
||||
* @param it
|
||||
* @brief addr
|
||||
* @brief link_key
|
||||
* @brief type of link key
|
||||
* @returns 1, if valid link key found
|
||||
*/
|
||||
int gap_link_key_iterator_get_next(btstack_link_key_iterator_t * it, bd_addr_t bd_addr, link_key_t link_key, link_key_type_t * type);
|
||||
|
||||
/**
|
||||
* @brief Frees resources allocated by iterator_init
|
||||
* @note Must be called after iteration to free resources
|
||||
* @param it
|
||||
*/
|
||||
void gap_link_key_iterator_done(btstack_link_key_iterator_t * it);
|
||||
|
||||
/**
|
||||
* @brief Start GAP Classic Inquiry
|
||||
* @param duration in 1.28s units
|
||||
|
14
src/hci.c
14
src/hci.c
@ -352,6 +352,20 @@ void gap_store_link_key_for_bd_addr(bd_addr_t addr, link_key_t link_key, link_ke
|
||||
log_info("gap_store_link_key_for_bd_addr: %s, type %u", bd_addr_to_str(addr), type);
|
||||
hci_stack->link_key_db->put_link_key(addr, link_key, type);
|
||||
}
|
||||
|
||||
int gap_link_key_iterator_init(btstack_link_key_iterator_t * it){
|
||||
if (!hci_stack->link_key_db) return 0;
|
||||
if (!hci_stack->link_key_db->iterator_init) return 0;
|
||||
return hci_stack->link_key_db->iterator_init(it);
|
||||
}
|
||||
int gap_link_key_iterator_get_next(btstack_link_key_iterator_t * it, bd_addr_t bd_addr, link_key_t link_key, link_key_type_t * type){
|
||||
if (!hci_stack->link_key_db) return 0;
|
||||
return hci_stack->link_key_db->iterator_get_next(it, bd_addr, link_key, type);
|
||||
}
|
||||
void gap_link_key_iterator_done(btstack_link_key_iterator_t * it){
|
||||
if (!hci_stack->link_key_db) return;
|
||||
hci_stack->link_key_db->iterator_done(it);
|
||||
}
|
||||
#endif
|
||||
|
||||
static int hci_is_le_connection(hci_connection_t * connection){
|
||||
|
Loading…
x
Reference in New Issue
Block a user