clean up bonding code

This commit is contained in:
hathach committed 2020-03-14 16:43:16 +07:00
1 parent b555131ca2
commit 1a9415005b
2 files changed
+1 -43

No files matched your search

@@ -318,44 +318,6 @@ void bond_print_list(uint8_t role)
dir.close();
}
bool bond_find_cntr(ble_gap_addr_t const * addr, bond_keys_t* bkeys)
{
bool found = false;
File dir(BOND_DIR_CNTR, FILE_O_READ, InternalFS);
File file(InternalFS);
while ( (file = dir.openNextFile(FILE_O_READ)) )
{
// Read bond data of each stored file
int keylen = file.read();
if ( keylen == sizeof(bond_keys_t) )
{
file.read((uint8_t*) bkeys, keylen);
// Compare static address
if ( !memcmp(addr->addr, bkeys->peer_id.id_addr_info.addr, 6) )
{
found = true;
}
else if ( addr->addr_type == BLE_GAP_ADDR_TYPE_RANDOM_PRIVATE_RESOLVABLE )
{
// Resolving private address
}
}
file.close();
if ( found ) break;
}
file.close();
dir.close();
return found;
}
/*------------------------------------------------------------------*/
/* DELETE
*------------------------------------------------------------------*/
@@ -60,15 +60,11 @@ void bond_clear_all(void);
void bond_remove_key(uint8_t role, ble_gap_addr_t const* id_addr);
bool bond_save_keys (uint8_t role, uint16_t conn_hdl, bond_keys_t const* bkeys);
bool bond_load_keys(uint8_t role, ble_gap_addr_t*, bond_keys_t* bkeys);
bool bond_load_keys(uint8_t role, ble_gap_addr_t* peer_addr, bond_keys_t* bkeys);
bool bond_save_cccd (uint8_t role, uint16_t conn_hdl, ble_gap_addr_t const* id_addr);
bool bond_load_cccd (uint8_t role, uint16_t conn_hdl, ble_gap_addr_t const* id_addr);
void bond_print_list(uint8_t role);
bool bond_find_cntr(ble_gap_addr_t const * addr, bond_keys_t* bkeys);
#endif /* BONDING_H_ */