Function find_device

Source
pub async fn find_device(identifier: &str) -> Result<(Adapter, Peripheral)>
Expand description

Find a device by its address, identifier or full name.

identifier is trimmed and case is ignored, but otherwise it must match one of these exactly:

  • the device’s DiscoveredDevice::identifier: the MAC address on Linux and Windows, the CoreBluetooth UUID on macOS;
  • btleplug’s device ID as DiscoveredDevice::id displays it (hci0/dev_AA_BB_CC_DD_EE_FF on Linux);
  • the MAC address, with or without colons;
  • the whole advertised name. On macOS a name shown as "Kitchen [Aranet4 1A2B3]" also matches Kitchen or Aranet4 1A2B3.

An address or identifier match wins over a name match.

The device is searched for as find_device_with_options describes, with the default ScanOptions.

§Errors