Contributing to btleplug
We welcome contributions from the community! Whether it's a bug report, a new feature, or documentation improvements, your help is appreciated.
Reporting Issues
If you encounter a bug or have a feature request, please use the issue templates provided in the repository:
- Bug report: For reporting problems with the library.
- Feature Requests: For suggesting new features or enhancements.
Please provide as much detail as possible, including your operating system, btleplug
version, and steps to reproduce the issue.
Development Setup
-
Fork and Clone: Fork the repository on GitHub and clone your fork locally.
git clone https://github.com/YOUR_USERNAME/btleplug.git cd btleplug
-
Install Rust: Ensure you have a recent version of the Rust toolchain installed. You can get it from rustup.rs.
-
Platform Dependencies: Depending on your operating system, you may need to install additional development libraries.
-
Linux: You need the
libdbus-1-dev
package (or its equivalent for your distribution) for BlueZ communication.# On Debian/Ubuntu sudo apt-get update sudo apt-get install libdbus-1-dev
-
Windows & macOS: No special dependencies are required beyond the standard Rust toolchain and build tools.
-
Android: You will need the Android NDK and a Java Development Kit (JDK) version 17 or higher.
-
Running Checks and Tests
Before submitting a pull request, please ensure that all checks and tests pass.
Formatting
This project uses rustfmt
to maintain a consistent code style. Run it before committing your changes:
cargo fmt --all
Linting (Clippy)
Check your code for common mistakes and style issues with clippy
:
cargo clippy --all-features -- -D warnings
Running Tests
Run the test suite to ensure your changes haven't introduced any regressions:
cargo test --all
Note that some tests may require a functional Bluetooth adapter.
Submitting a Pull Request
- Create a new branch for your feature or bugfix.
- Commit your changes with clear and descriptive messages.
- Push your branch to your fork.
- Open a pull request against the
master
branch of the maindeviceplug/btleplug
repository. - Ensure the pull request description clearly explains the changes and the problem they solve.