Keep the stack's bondings and CCCD states in sync with persistent storage.
More...
Keep the stack's bondings and CCCD states in sync with persistent storage.
The firmware owns persistent storage. It pushes the stored bondings and Client Characteristic Configuration Descriptor states into the stack with the pbl_bt_handle_host_* functions, and the stack reports new bondings through pbl_bt_cb_handle_create_bonding().
◆ pbl_bt_bonding
A bonding with a remote device.
Packed because it is serialized.
| Data Fields |
|
uint8_t |
flags: 5 |
Backend specific flags. The NimBLE backend sets bit 0 for Secure Connections and bit 1 for an authenticated (MITM protected) pairing. Persistent storage keeps only 5 bits.
|
|
bool |
is_gateway: 1 |
True if the remote device is capable of talking PPoGATT. |
|
struct pbl_bt_sm_pairing_info |
pairing_info |
Keys and identity exchanged during pairing. |
|
struct pbl_bt_addr |
pinned_address |
Address to pin. Valid iff should_pin_address is true.
|
|
uint8_t |
rsvd: 1 |
Reserved. |
|
bool |
should_pin_address: 1 |
True if the local device address should be pinned. |
◆ pbl_bt_cccd
Stored Client Characteristic Configuration Descriptor state of a peer.
| Data Fields |
|
uint16_t |
chr_val_handle |
Value handle of the characteristic the CCCD belongs to. |
|
uint16_t |
flags |
CCCD value: bit 0 enables notifications, bit 1 indications. |
|
struct pbl_bt_device_internal |
peer |
The peer device. |
|
bool |
value_changed: 1 |
True if the value changed while the peer was disconnected. |
◆ pbl_bt_cb_handle_create_bonding()
Called after a new device was paired, to persist the bonding.
Implemented by the firmware. The NimBLE backend calls it on KernelMain.
- Parameters
-
| bonding | The new bonding. |
| addr | Address of the connection, used to associate the bonding with its GAPLEConnection. |
◆ pbl_bt_handle_host_added_bonding()
| void pbl_bt_handle_host_added_bonding |
( |
const struct pbl_bt_bonding * |
bonding | ) |
|
Register an existing bonding with the stack.
Called by the firmware for each stored bonding, before starting the stack so they can be restored. There are no matching removal calls when the stack stops.
- Parameters
-
◆ pbl_bt_handle_host_added_cccd()
| void pbl_bt_handle_host_added_cccd |
( |
const struct pbl_bt_cccd * |
cccd | ) |
|
Register a stored CCCD state with the stack.
- Parameters
-
◆ pbl_bt_handle_host_removed_bonding()
| void pbl_bt_handle_host_removed_bonding |
( |
const struct pbl_bt_bonding * |
bonding | ) |
|
Unregister a bonding, for example after the user forgot it in Settings.
- Parameters
-
◆ pbl_bt_handle_host_removed_cccd()
| void pbl_bt_handle_host_removed_cccd |
( |
const struct pbl_bt_cccd * |
cccd | ) |
|
Unregister a stored CCCD state.
- Parameters
-