Skip to main content

Crate nimble_rs

Crate nimble_rs 

Source
Expand description

Safe, async, cross-platform Rust API for the esp-nimble BLE host, running over any bt-hci controller.

Work in progress - see docs/PLAN.md in the repository root. The overall architecture:

  • The NimBLE C host is compiled by nimble-rs-sys; its OS layer (NPL) and HCI transport are implemented here, in Rust (npl, hci modules) - thread-free and allocation-free.
  • Ble::run is the single future that drives everything: the host event loop, the callout timers and the HCI pump. Host API calls may briefly stall the executor while awaiting a command ack from the controller (bounded by the HCI command timeout) - the same latency the C design imposes, just not hidden behind a context switch.

Re-exports§

pub use hci::AdvCmds;
pub use hci::CentralCmds;
pub use hci::ConnCmds;
pub use hci::Controller;
pub use hci::CoreCmds;
pub use hci::ScanCmds;
pub use hci::SmCmds;

Modules§

gap
GAP: device name, connection events, and advertising.
gatt
GATT: shared types and helpers.
hci
The HCI bridge between the NimBLE C host and a bt-hci controller.
mbuf
Safe interaction with the NimBLE os_mbuf buffer system.

Macros§

gatt_services
Define a static (compile-time, heap-free) GATT service table.

Structs§

Ble
The BLE host driver: a singleton wrapping the NimBLE host stack.
BleAddr
A BLE device address (type + 6 bytes).
BleError
An error code from the NimBLE host (the BLE_HS_E* namespace), or 0.
SpinParker
The universal fallback parker: never sleeps, making the wait loop a busy poll with a spin_loop hint.

Enums§

BleUuid
A BLE UUID, either 16-bit (assigned) or 128-bit (vendor-specific).
HostEvent
Events of the host stack itself.

Constants§

CONN_HANDLE_NONE
The “no connection” handle: local GATT reads and writes carry this instead of a real connection handle.

Traits§

Parker
How a blocked NPL operation sleeps and is woken.

Type Aliases§

ConnHandle
A connection handle.