Skip to content

Commit 1a94150

Browse files
committed
clean up bonding code
1 parent b555131 commit 1a94150

File tree

2 files changed

+1
-43
lines changed

2 files changed

+1
-43
lines changed

libraries/Bluefruit52Lib/src/utility/bonding.cpp

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -318,44 +318,6 @@ void bond_print_list(uint8_t role)
318318
dir.close();
319319
}
320320

321-
322-
bool bond_find_cntr(ble_gap_addr_t const * addr, bond_keys_t* bkeys)
323-
{
324-
bool found = false;
325-
326-
File dir(BOND_DIR_CNTR, FILE_O_READ, InternalFS);
327-
File file(InternalFS);
328-
329-
while ( (file = dir.openNextFile(FILE_O_READ)) )
330-
{
331-
// Read bond data of each stored file
332-
int keylen = file.read();
333-
if ( keylen == sizeof(bond_keys_t) )
334-
{
335-
file.read((uint8_t*) bkeys, keylen);
336-
337-
// Compare static address
338-
if ( !memcmp(addr->addr, bkeys->peer_id.id_addr_info.addr, 6) )
339-
{
340-
found = true;
341-
}
342-
else if ( addr->addr_type == BLE_GAP_ADDR_TYPE_RANDOM_PRIVATE_RESOLVABLE )
343-
{
344-
// Resolving private address
345-
}
346-
}
347-
348-
file.close();
349-
350-
if ( found ) break;
351-
}
352-
353-
file.close();
354-
dir.close();
355-
356-
return found;
357-
}
358-
359321
/*------------------------------------------------------------------*/
360322
/* DELETE
361323
*------------------------------------------------------------------*/

libraries/Bluefruit52Lib/src/utility/bonding.h

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,15 +60,11 @@ void bond_clear_all(void);
6060
void bond_remove_key(uint8_t role, ble_gap_addr_t const* id_addr);
6161

6262
bool bond_save_keys (uint8_t role, uint16_t conn_hdl, bond_keys_t const* bkeys);
63-
bool bond_load_keys(uint8_t role, ble_gap_addr_t*, bond_keys_t* bkeys);
63+
bool bond_load_keys(uint8_t role, ble_gap_addr_t* peer_addr, bond_keys_t* bkeys);
6464

6565
bool bond_save_cccd (uint8_t role, uint16_t conn_hdl, ble_gap_addr_t const* id_addr);
6666
bool bond_load_cccd (uint8_t role, uint16_t conn_hdl, ble_gap_addr_t const* id_addr);
6767

6868
void bond_print_list(uint8_t role);
6969

70-
bool bond_find_cntr(ble_gap_addr_t const * addr, bond_keys_t* bkeys);
71-
72-
73-
7470
#endif /* BONDING_H_ */

0 commit comments

Comments
 (0)