pub struct BluetoothSession { /* private fields */ }
Expand description

A connection to the Bluetooth daemon. This can be cheaply cloned and passed around to be used from different places. It is the main entry point to the library.

Implementations

Establish a new D-Bus connection to communicate with BlueZ.

Returns a tuple of (join handle, Self). If the join handle ever completes then you’re in trouble and should probably restart the process.

Power on all Bluetooth adapters, remove any discovery filter, and then start scanning for devices.

This is equivalent to calling start_discovery_with_filter(&DiscoveryFilter::default()).

Power on the given Bluetooth adapter, remove any discovery filter, and then start scanning for devices.

This is equivalent to calling start_discovery_on_adapter_with_filter(adapter, &DiscoveryFilter::default()).

Power on all Bluetooth adapters, set the given discovery filter, and then start scanning for devices.

Note that BlueZ combines discovery filters from all clients and sends events matching any filter to all clients, so you may receive unexpected discovery events if there are other clients on the system using Bluetooth as well.

In most common cases, DiscoveryFilter::default() is fine.

Power on the given Bluetooth adapter, set the given discovery filter, and then start scanning for devices.

Note that BlueZ combines discovery filters from all clients and sends events matching any filter to all clients, so you may receive unexpected discovery events if there are other clients on the system using Bluetooth as well.

In most common cases, DiscoveryFilter::default() is fine.

Stop scanning for devices on all Bluetooth adapters.

Stop scanning for devices on the given Bluetooth adapters.

Get a list of all Bluetooth adapters on the system.

Get a list of all Bluetooth devices which have been discovered so far.

Get a list of all Bluetooth devices which have been discovered so far on a given adapter.

Get a list of all GATT services which the given Bluetooth device offers.

Note that this won’t be filled in until the device is connected.

Get a list of all characteristics on the given GATT service.

Get a list of all descriptors on the given GATT characteristic.

Find a GATT service with the given UUID advertised by the given device, if any.

Note that this generally won’t work until the device is connected.

Find a characteristic with the given UUID as part of the given GATT service advertised by a device, if there is any.

Convenience method to get a GATT charactacteristic with the given UUID advertised by a device as part of the given service.

This is equivalent to calling get_service_by_uuid and then get_characteristic_by_uuid.

Get information about the given Bluetooth device.

Get information about the given Bluetooth adapter.

Get information about the given GATT service.

Get information about the given GATT characteristic.

Get information about the given GATT descriptor.

Connect to the given Bluetooth device.

Connect to the given Bluetooth device with specified timeout.

Disconnect from the given Bluetooth device.

Read the value of the given GATT characteristic.

This is equivalent to calling read_characteristic_value_with_offset(0).

Read the value of the given GATT characteristic, starting from the given offset.

Write the given value to the given GATT characteristic, with default options.

This is equivalent to calling write_characteristic_value_with_options(WriteOptions::default()).

Write the given value to the given GATT characteristic, with the given options.

Read the value of the given GATT descriptor.

This is equivalent to calling read_descriptor_value_with_offset(0).

Read the value of the given GATT descriptor, starting from the given offset.

Write the given value to the given GATT descriptor.

This is equivalent to calling write_descriptor_value_with_offset(0).

Write the given value to the given GATT descriptor, starting from the given offset.

Start notifications on the given GATT characteristic.

Stop notifications on the given GATT characteristic.

Get a stream of events for all devices.

Get a stream of events for a particular adapter. This includes events for all devices it discovers or connects to.

Get a stream of events for a particular device. This includes events for all its characteristics.

Note that this will not include the device discovered event for that device, as it is considered an event for the adapter rather than the device itself.

Get a stream of events for a particular characteristic of a device.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.