Module btleplug::api

source ·
Expand description

The api module contains the traits and types which make up btleplug’s API. These traits have a different implementation for each supported platform, but only one implementation can be found on any given platform. These implementations are in the platform module.

You will may want to import both the traits and their implementations, like:

use btleplug::api::{Central, Manager as _, Peripheral as _};
use btleplug::platform::{Adapter, Manager, Peripheral};

Modules

  • Utilities for dealing with BLE UUIDs, converting to and from their short formats.

Structs

  • Stores the 6 byte address used to identify Bluetooth devices.
  • A set of properties that indicate what operations are supported by a Characteristic.
  • A Bluetooth characteristic. Characteristics are the main way you will interact with other bluetooth devices. Characteristics are identified by a UUID which may be standardized (like 0x2803, which identifies a characteristic for reading heart rate measurements) but more often are specific to a particular device. The standard set of characteristics can be found here.
  • Add doc
  • The properties of this peripheral, as determined by the advertising reports we’ve received for it.
  • The filter used when scanning for BLE devices.
  • A GATT service. Services are groups of characteristics, which may be standard or device-specific.
  • A notification sent from a peripheral due to a change in a value.

Enums

Traits

  • Central is the “client” of BLE. It’s able to scan for and establish connections to peripherals. A Central can be obtained from Manager::adapters().
  • The Manager is the entry point to the library, providing access to all the Bluetooth adapters on the system. You can obtain an instance from platform::Manager::new().
  • Peripheral is the device that you would like to communicate with (the “server” of BLE). This struct contains both the current state of the device (its properties, characteristics, etc.) as well as functions for communication.