2024-04-28 12:23 PM
My application is a BLE peripheral with no display and no keyboard. When idling, the device advertises once every 1-2.5 seconds. When the user presses the button on the device, it goes into "pairing mode" and starts advertising once every 80-100 ms.
What I would like to do now is to prevent unauthorized central devices from connecting to my peripheral. When the unit is in idle, I want it to accept connections only from devices it recognizes. When it's in "pairing mode", I want it to accept connections from any device, then add devices which make a connection to the filter accept list.
At the moment, when the peripheral is in "pairing mode", I initialize advertising like this:
ret = aci_gap_set_discoverable(ADV_IND,
Min_Inter,
Max_Inter,
CFG_BLE_ADDRESS_TYPE,
NO_WHITE_LIST_USE,
0,
0,
0,
0,
0,
0);
When the peripheral is idle, I initialize advertising like this:
ret = aci_gap_set_undirected_connectable(Min_Inter,
Max_Inter,
CFG_BLE_ADDRESS_TYPE,
WHITE_LIST_FOR_ALL);
If the peripheral is in pairing mode, then after disconnect is complete, but before I restart advertising, I call this command:
ret = hci_le_add_device_to_filter_accept_list(Peer_Address_Type, Peer_Address);
However, when this is called, I get result `0x01`, which according to AN5270 is "Unknown HCI command".
How can I implement a minimal filter accept list? I have not been able to find a working example online, but I imagine this is a fairly common requirement for BLE devices.
Thank you!
2024-05-30 11:02 AM