Crates.io | bumble |
lib.rs | bumble |
version | 0.2.0 |
source | src |
created_at | 2023-07-31 18:50:44.05705 |
updated_at | 2024-03-21 18:41:32.458454 |
description | Rust API for the Bumble Bluetooth stack |
homepage | https://google.github.io/bumble/index.html |
repository | https://github.com/google/bumble |
max_upload_size | |
id | 931147 |
size | 676,205 |
Rust wrappers around the Bumble Python API.
Method calls are mapped to the equivalent Python, and return types adapted where relevant.
See the CLI in src/main.rs
or the examples
directory for how to use the
Bumble API.
Set up a virtualenv for Bumble, or otherwise have an isolated Python environment for Bumble and its dependencies.
Due to Python being
[picky about how its sys path is set up](https://github.com/PyO3/pyo3/issues/1741,
it's necessary to explicitly point to the virtualenv's site-packages
. Use
suitable virtualenv paths as appropriate for your OS, as seen here running
the battery_client
example:
PYTHONPATH=..:~/.virtualenvs/bumble/lib/python3.10/site-packages/ \
cargo run --example battery_client -- \
--transport android-netsim --target-addr F0:F1:F2:F3:F4:F5
Run the corresponding battery_server
Python example, and launch an emulator in
Android Studio (currently, Canary is required) to run netsim.
Explore the available subcommands:
PYTHONPATH=..:[virtualenv site-packages] \
cargo run --features bumble-tools --bin bumble -- --help
Notable subcommands:
firmware realtek download
: download Realtek firmware for various chipsets so that it can be automatically loaded when neededusb probe
: show USB devices, highlighting the ones usable for BluetoothRun the tests:
PYTHONPATH=.. cargo test
Check lints:
cargo clippy --all-targets
To have the fastest startup while keeping the build simple, code gen for
assigned numbers is done with the gen_assigned_numbers
tool. It should
be re-run whenever the Python assigned numbers are changed. To ensure that the
generated code is kept up to date, the Rust data is compared to the Python
in tests at pytests/assigned_numbers.rs
.
To regenerate the assigned number tables based on the Python codebase:
PYTHONPATH=.. cargo run --bin gen-assigned-numbers --features dev-tools