PebbleOS v4.47.0-372-gac5760587
Loading...
Searching...
No Matches

Peers the stack is bonded with, identified by their identity address. More...

Data Structures

struct  pbl_bt_bond_info
 A bonded peer. More...
 
struct  pbl_bt_bond_keys
 The keys of a bond, to copy it to or from other storage. More...
 

Macros

#define PBL_BT_BOND_FLAG_SECURE_CONNECTIONS   0x01U
 Bond flag: paired with Secure Connections.
 
#define PBL_BT_BOND_FLAG_AUTHENTICATED   0x02U
 Bond flag: the pairing was authenticated (MITM protected).
 

Typedefs

typedef void(* pbl_bt_bond_cb_t) (const struct pbl_bt_bond_info *info, void *user_data)
 Callback for pbl_bt_foreach_bond().
 

Functions

void pbl_bt_foreach_bond (pbl_bt_bond_cb_t func, void *user_data)
 Iterate over the bonds.
 
size_t pbl_bt_bond_count (void)
 Count the bonds.
 
int pbl_bt_bond_get (const struct pbl_bt_device_internal *addr, struct pbl_bt_bond_info *info)
 Get a bond.
 
int pbl_bt_bond_get_keys (const struct pbl_bt_device_internal *addr, struct pbl_bt_bond_keys *keys)
 Get the keys of a bond.
 
int pbl_bt_bond_set_keys (const struct pbl_bt_bond_keys *keys)
 Add a bond from its keys, or replace the keys of the one with the same peer.
 
int pbl_bt_unpair (const struct pbl_bt_device_internal *addr)
 Delete a bond, with its Client Characteristic Configuration Descriptor states.
 
void pbl_bt_cb_bond_added (const struct pbl_bt_bond_info *info)
 Called after bonding with a new peer.
 
void pbl_bt_cb_bond_changed (const struct pbl_bt_bond_info *info)
 Called after the keys of a bond changed, for example when its peer paired again.
 
void pbl_bt_cb_bond_deleted (const struct pbl_bt_device_internal *addr)
 Called after a bond was deleted.
 

Detailed Description

Peers the stack is bonded with, identified by their identity address.

The stack keeps its bonds, with their keys and Client Characteristic Configuration Descriptor states, in the NimBLE store. They can be read and deleted with the stack stopped as well.

Changes are reported on KernelMain through pbl_bt_cb_bond_added(), pbl_bt_cb_bond_changed() and pbl_bt_cb_bond_deleted(), after the store has them.


Data Structure Documentation

◆ pbl_bt_bond_info

struct pbl_bt_bond_info

A bonded peer.

Data Fields
struct pbl_bt_device_internal addr Identity address of the peer.
struct pbl_bt_sm_key irk Identity Resolving Key of the peer, valid if irk_valid.
bool irk_valid True if the peer distributed its Identity Resolving Key.

◆ pbl_bt_bond_keys

struct pbl_bt_bond_keys

The keys of a bond, to copy it to or from other storage.

Data Fields
uint8_t flags PBL_BT_BOND_FLAG_* values.
struct pbl_bt_sm_pairing_info info Keys and identity exchanged during pairing.

Macro Definition Documentation

◆ PBL_BT_BOND_FLAG_AUTHENTICATED

#define PBL_BT_BOND_FLAG_AUTHENTICATED   0x02U

Bond flag: the pairing was authenticated (MITM protected).

◆ PBL_BT_BOND_FLAG_SECURE_CONNECTIONS

#define PBL_BT_BOND_FLAG_SECURE_CONNECTIONS   0x01U

Bond flag: paired with Secure Connections.

Typedef Documentation

◆ pbl_bt_bond_cb_t

typedef void(* pbl_bt_bond_cb_t) (const struct pbl_bt_bond_info *info, void *user_data)

Callback for pbl_bt_foreach_bond().

Parameters
infoThe bond.
user_dataAs passed to pbl_bt_foreach_bond().

Function Documentation

◆ pbl_bt_bond_count()

size_t pbl_bt_bond_count ( void  )

Count the bonds.

Returns
Number of bonds.

◆ pbl_bt_bond_get()

int pbl_bt_bond_get ( const struct pbl_bt_device_internal *  addr,
struct pbl_bt_bond_info *  info 
)

Get a bond.

Parameters
addrIdentity address of the peer.
[out]infoThe bond. May be NULL.
Return values
0Success.
-ENOENTNot bonded with addr.

◆ pbl_bt_bond_get_keys()

int pbl_bt_bond_get_keys ( const struct pbl_bt_device_internal *  addr,
struct pbl_bt_bond_keys *  keys 
)

Get the keys of a bond.

Parameters
addrIdentity address of the peer.
[out]keysThe keys.
Return values
0Success.
-ENOENTNot bonded with addr.

◆ pbl_bt_bond_set_keys()

int pbl_bt_bond_set_keys ( const struct pbl_bt_bond_keys *  keys)

Add a bond from its keys, or replace the keys of the one with the same peer.

For bonds made elsewhere, before the stack starts. Nothing is written if the store has the same keys, and no callback is called.

Parameters
keysThe keys.
Return values
0Success.
-EIOThe store could not take them.

◆ pbl_bt_cb_bond_added()

void pbl_bt_cb_bond_added ( const struct pbl_bt_bond_info *  info)
extern

Called after bonding with a new peer.

Implemented by the firmware. Runs on KernelMain.

Parameters
infoThe new bond.

◆ pbl_bt_cb_bond_changed()

void pbl_bt_cb_bond_changed ( const struct pbl_bt_bond_info *  info)
extern

Called after the keys of a bond changed, for example when its peer paired again.

Implemented by the firmware. Runs on KernelMain.

Parameters
infoThe bond.

◆ pbl_bt_cb_bond_deleted()

void pbl_bt_cb_bond_deleted ( const struct pbl_bt_device_internal *  addr)
extern

Called after a bond was deleted.

Implemented by the firmware. Runs on KernelMain.

Parameters
addrIdentity address of the peer.

◆ pbl_bt_foreach_bond()

void pbl_bt_foreach_bond ( pbl_bt_bond_cb_t  func,
void *  user_data 
)

Iterate over the bonds.

Parameters
funcCalled for each bond. It must not add or delete bonds.
user_dataPassed to func.

◆ pbl_bt_unpair()

int pbl_bt_unpair ( const struct pbl_bt_device_internal *  addr)

Delete a bond, with its Client Characteristic Configuration Descriptor states.

A connection to the peer is left as it is.

Parameters
addrIdentity address of the peer, or NULL for all bonds.
Return values
0Success.
-ENOENTNot bonded with addr.
-EIOStore error.