|
PebbleOS v4.47.0-512-g5285d4236
|
Bluetooth Low Energy stack interface (pbl/bluetooth).
More...
Modules | |
| AMS | |
| The Apple Media Service: its values and formats. | |
| ANCS | |
| The Apple Notification Center Service: its values and formats. | |
| Battery Service | |
| GATT Battery Service. | |
| Bonds | |
| Peers the stack is bonded with, identified by their identity address. | |
| AMS client | |
| Client of the Apple Media Service of a connected iOS device. | |
| ANCS client | |
| Client of the Apple Notification Center Service of a connected iOS device. | |
| GATT client helpers | |
| What clients of a peer's GATT service share: finding the service, and being handed its notifications. | |
| Connection event statistics | |
| Controller statistics of connection events in the peripheral role. | |
| Device Information Service | |
| Values served by the GATT Device Information Service. | |
| GAP events | |
| The handler of a connection's GAP events. | |
| LE connections | |
| LE connection events and disconnection. | |
| Peer device names | |
| Read the GAP Device Name of connected peers. | |
| GATT | |
| GATT client operations, GATT events and the Service Changed characteristic. | |
| GATT service discovery | |
| Discover the GATT database of a connected peer. | |
| GATT service description | |
| Compact description of a discovered remote GATT service. | |
| HCI types | |
| HCI status codes. | |
| Local identity | |
| Local device name and addresses. | |
| Identity address source | |
| Where the watch's identity address comes from. | |
| ATT MTU | |
| ATT MTU limits. | |
| Pairability | |
| Whether new LE pairings are accepted. | |
| Pairing confirmation | |
| Ask the user to confirm a pairing request. | |
| Pebble identifiers | |
| Pebble-specific Bluetooth identifiers: service and characteristic UUIDs. | |
| Pebble Pairing Service | |
| GATT service through which the phone app checks the connection and triggers pairing. | |
| Reversed PPoGATT | |
| Reversed PPoGATT service: the watch hosts the service and the phone is the GATT client. | |
| PRF store | |
| The bonding and root keys the recovery firmware (PRF) and the normal firmware share. | |
| Responsiveness | |
| Connection response time requests and connection parameter updates. | |
| Security Manager types | |
| Keys and pairing information. | |
| Types | |
| Error codes, addresses, devices and advertising data shared by the Bluetooth API. | |
Data Structures | |
| struct | pbl_bt_config |
| Stack configuration passed to pbl_bt_start(). More... | |
Functions | |
| void | pbl_bt_init (void) |
| One-time initialization of the Bluetooth stack. | |
| bool | pbl_bt_start (struct pbl_bt_config *config) |
| Start the Bluetooth stack. | |
| void | pbl_bt_stop (void) |
| Stop the Bluetooth stack. | |
| void | pbl_bt_power_down_controller_on_boot (void) |
| Power down the controller at boot if Bluetooth is not going to be started. | |
| void | pbl_bt_handle_host_resynced (void) |
| Called each time the host (re-)synchronizes with the controller. | |
Bluetooth Low Energy stack interface (pbl/bluetooth).
The firmware's Bluetooth code (pebble/comm/ble and pebble/services/bluetooth) talks to the stack only through the pbl_bt_* API declared in these headers. It is implemented in subsys/bluetooth on top of the NimBLE host, which runs in its own task.
The API has two directions:
extern and named pbl_bt_handle_* or pbl_bt_cb_*, that the firmware implements and the stack invokes to report events. Unless stated otherwise they run on the NimBLE host task without bt_lock() held.The NimBLE host reaches its controller through the HCI transport selected with the NIMBLE_HCI_* Kconfig choice: the in-image NimBLE link layer (NIMBLE_HCI_NRF52), the SiFli LCPU over IPC (NIMBLE_HCI_SF32LB), H4 over UART (NIMBLE_HCI_UART) or a fake controller (NIMBLE_HCI_FAKE). The fake controller, used on QEMU, accepts every HCI command and never raises an event: the host synchronizes and the GATT server runs, but no link is ever established.
The watch is a peripheral only. Typical bring-up:
| struct pbl_bt_config |
Stack configuration passed to pbl_bt_start().
| Data Fields | ||
|---|---|---|
| struct pbl_bt_dis_info | dis_info | Values served by the Device Information Service. |
| struct pbl_bt_addr | identity_addr |
Identity address. Not used by the NimBLE backend, see pbl_bt_id_addr_get(). |
| struct pbl_bt_sm_key | root_keys[PBL_BT_SM_ROOT_KEY_TYPE_NUM] |
Root keys, indexed by enum pbl_bt_sm_root_key_type. The identity root key is the local Identity Resolving Key. The encryption root key is not used: the keys of a bond are generated and stored by the host. |
|
extern |
Called each time the host (re-)synchronizes with the controller.
Implemented by the firmware. The controller state is lost on a host reset, so this is where advertising data and parameters must be pushed again. Invoked on the NimBLE host task.
| void pbl_bt_init | ( | void | ) |
One-time initialization of the Bluetooth stack.
Creates the NimBLE host task (and the link layer task when the controller runs in the same image) and installs the bond store. Call once at boot, before any other function of this API.
| void pbl_bt_power_down_controller_on_boot | ( | void | ) |
Power down the controller at boot if Bluetooth is not going to be started.
Does nothing in the NimBLE backend.
| bool pbl_bt_start | ( | struct pbl_bt_config * | config | ) |
Start the Bluetooth stack.
Registers the GATT services, starts the host and waits for it to synchronize with the controller, then sets up the identity address. Does nothing if the stack is already running.
| config | Stack configuration. Only read during the call. |
| void pbl_bt_stop | ( | void | ) |
Stop the Bluetooth stack.
Blocks until the host has stopped, then resets the GATT server. Bonds are kept.