Question about the bond_db_store function?

⚠️
Hi there.. thanks for coming to the forums. Exciting news! we’re now in the process of moving to our new forum platform that will offer better functionality and is contained within the main Dialog website. All posts and accounts have been migrated. We’re now accepting traffic on the new forum only - please POST any new threads at//www.xmece.com/support. We’ll be fixing bugs / optimising the searching and tagging over the coming days.
4 posts / 0 new
Last post
cgha
Offline
Last seen:4 months 2 weeks ago
加入:2016-03-23 13:05
Question about the bond_db_store function?

the idx_found is not -1 when compare irk or mac_addr matchs, but the idx_found is renewed when idx_emtpy_slot_found == -1, so here why not just replace the exsisted bond info if the idx_found != -1 ?

if (-1 != idx_emtpy_slot_found) { idx_found = idx_emtpy_slot_found; } else { if(idx_found != -1){ //should I add this line here? // no empty slot found - delete the oldest bond data slot idx_found = bdb.next_slot++; bdb.next_slot = bdb.next_slot % APP_BOND_DB_MAX_BONDED_PEERS; } }

Device:
PM_Dialog
Offline
Last seen:12 hours 23 min ago
工作人员
加入:2018-02-08 11:03
Hi cgha,

Hi cgha,

I assume that you are working on the ble_app_sleepmode example of the SDK5.0.4. Is my understanding correct? If yes, according to the implementation of bond_db_store API, the oldest bonding data will be erased if there not enough slot level to add a new master's bonding information. From the function procedure, if there is an empty slot (denoted by idx_emtpy_slot_found), no matter the case that there is an address match, the bond info will always be put in the new slot.

Thanks, PM_Dialog

cgha
Offline
Last seen:4 months 2 weeks ago
加入:2016-03-23 13:05
Do you mean the comparison

Do you mean the comparison with irk and mac_addr is redundancy? Since the idx_found will always be reassigned regardless of matching of irk or mac_addr.

PM_Dialog
Offline
Last seen:12 hours 23 min ago
工作人员
加入:2018-02-08 11:03
Hi cgha,

Hi cgha,

The oldest bonding data will be erased if there not enough slot level to add a new master's bonding information. In case of idx_emtpy_slot_found, no matter the case that there is an address match, the bond info will always be put in the new slot.

Thanks, PM_Dialog