btleplug: Cross-Platform Bluetooth LE for Rust

btleplug is a comprehensive, asynchronous Rust library designed for Bluetooth Low Energy (BLE) communication. It provides a unified, cross-platform API for applications that need to act as a BLE central—that is, applications that scan for, connect to, and interact with peripheral devices like smart sensors, lights, and wearables.

This library grew out of a need for a modern, async-first, and actively maintained BLE library in the Rust ecosystem, supporting major desktop and mobile operating systems.

Key Features

  • Asynchronous API: Built on modern Rust's async/await syntax, making it efficient and easy to integrate into asynchronous applications.
  • Cross-Platform: A single API supports Windows, macOS, Linux (via BlueZ), iOS, and Android.
  • Central Role Focus: Specialized for the BLE central role, which includes discovering peripherals, connecting, reading, writing, and subscribing to characteristics.
  • Event-Driven and Polling APIs: Offers flexibility in how you discover and manage devices—either by polling a list of discovered peripherals or by reacting to a stream of events.

Important Considerations

  • Central Mode Only: This library does not support the BLE peripheral role (i.e., making your device appear as a BLE accessory). For peripheral mode, consider libraries like bluster.
  • No Bluetooth Classic: btleplug exclusively supports Bluetooth Low Energy (BLE) and does not support Bluetooth Classic (BT2.x).

Platform Support

The library aims for feature parity across all supported platforms. The current status is as follows:

Feature Windows MacOS / iOS Linux Android
Bring Up Adapter X X X X
Handle Multiple Adapters X
Discover Devices X X X X
└ Discover Services X X X X
└ Discover Characteristics X X X X
└ Discover Descriptors X X X X
└ Discover Name X X X X
└ Discover Manufacturer Data X X X X
└ Discover Service Data X X X X
└ Discover MAC address X X X
GATT Server Connect X X X X
GATT Server Connect Event X X X X
GATT Server Disconnect X X X X
GATT Server Disconnect Event X X X X
Write to Characteristic X X X X
Read from Characteristic X X X X
Subscribe to Characteristic X X X X
Unsubscribe from Characteristic X X X X
Get Characteristic Notification Event X X X X
Read Descriptor X X X X
Write Descriptor X X X X
Retrieve MTU
Retrieve Connection Interval

(X: Completed and released, O: In development, Blank: Not started)