le_device_db: add le_device_db_max_count() for index iteration

This commit is contained in:
Matthias Ringwald 2018-03-15 16:25:59 +01:00
parent 1882d12dc3
commit 6fc9dda195
5 changed files with 23 additions and 1 deletions

View File

@ -260,6 +260,10 @@ int le_device_db_count(void){
return counter;
}
int le_device_db_max_count(void){
return LE_DEVICE_MEMORY_SIZE;
}
// free device
void le_device_db_remove(int index){
le_devices[index].addr_type = INVALID_ENTRY_ADDR_TYPE;

View File

@ -191,6 +191,10 @@ int le_device_db_count(void){
return counter;
}
int le_device_db_max_count(void){
return NVM_NUM_LE_DEVICES;
}
// get device information: addr type and address
void le_device_db_info(int device_index, int * addr_type, bd_addr_t addr, sm_key_t irk){
int absolute_index = le_device_db_get_absolute_index_for_device_index(device_index);

View File

@ -84,11 +84,17 @@ void le_device_db_set_local_bd_addr(bd_addr_t bd_addr);
int le_device_db_add(int addr_type, bd_addr_t addr, sm_key_t irk);
/**
* @brief get number of devices in db for enumeration
* @brief get number of devices in db
* @returns number of device in db
*/
int le_device_db_count(void);
/**
* @brief get max number of devices in db for enumeration
* @returns max number of device in db
*/
int le_device_db_max_count(void);
/**
* @brief get device information: addr type and address needed to identify device
* @param index

View File

@ -106,6 +106,10 @@ int le_device_db_count(void){
return counter;
}
int le_device_db_max_count(void){
return MAX_NR_LE_DEVICE_DB_ENTRIES;
}
// free device
void le_device_db_remove(int index){
le_devices[index].addr_type = INVALID_ENTRY_ADDR_TYPE;

View File

@ -170,6 +170,10 @@ int le_device_db_count(void){
return num_valid_entries;
}
int le_device_db_max_count(void){
return NVM_NUM_DEVICE_DB_ENTRIES;
}
void le_device_db_remove(int index){
// delete entry in TLV
le_device_db_tlv_delete(index);