Expand description

BlueR — Official BlueZ Bindings for Rust

This library provides the official Rust interface to the Linux Bluetooth protocol stack (BlueZ). Both publishing local and consuming remote GATT services using idiomatic Rust code is supported. L2CAP and RFCOMM sockets are presented using an API similar to Tokio networking.

This library depends on the tokio asynchronous runtime.

The following functionality is provided.

Currently, some classic Bluetooth (BR/EDR) functionality is missing. However, pull requests and contributions are welcome!

Crate features

The following crate features are available.

  • bluetoothd: Enables all functions requiring a running Bluetooth daemon.
  • id: Enables database of assigned numbers.
  • l2cap: Enables L2CAP sockets.
  • rfcomm: Enables RFCOMM sockets.
  • serde: Enables serialization and deserialization of some data types.

To enable all crate features specify the full crate feature.

Basic usage

Create a Session using Session::new; this establishes a connection to the Bluetooth daemon. Then obtain a Bluetooth adapter using Session::adapter. From there on you can access most of the functionality using the methods provided by Adapter.

L2CAP and RFCOMM sockets

Refer to the l2cap and rfcomm modules. No Session and therefore no running Bluetooth daemon is required.

Re-exports

pub use uuid::Uuid;

Modules

advbluetoothd
Bluetooth LE advertising.
agentbluetoothd
Bluetooth authorization agent.
gattbluetoothd
Local and remote GATT services.
idid
Manufacturer ids and assigned UUIDs for service classes and profiles, GATT services, GATT characteristics and GATT descriptors.
l2capl2cap
Logical Link Control and Adaptation Protocol (L2CAP) sockets.
rfcommrfcomm
Radio frequency communication (RFCOMM) sockets and profiles.

Structs

Adapterbluetoothd
Interface to a Bluetooth adapter.
Bluetooth address.
Devicebluetoothd
Interface to a Bluetooth device.
Errorbluetoothd
Bluetooth error.
Invalid Bluetooth address error.
Modaliasbluetoothd
Linux kernel modalias information.
Sessionbluetoothd
Bluetooth session.

Enums

AdapterEventbluetoothd
Bluetooth adapter event.
AdapterPropertybluetoothd
Bluetooth adapter property.
Bluetooth device address type.
DeviceEventbluetoothd
Bluetooth device event.
DevicePropertybluetoothd
Bluetooth device property.
ErrorKindbluetoothd
Bluetooth error kind.
Internal Bluetooth error kind.
SessionEventbluetoothd
Bluetooth session event.

Traits

UUID extension trait to convert to and from Bluetooth short UUIDs.

Type Definitions

Resultbluetoothd
Bluetooth result.