# Interface BleBackend

All Known Implementing Classes:
  `HelperBleBackend`

public interface BleBackend
The pluggable BLE engine seam. The simulator ships its own `SimulatorBleBackend`; the real-radio `HelperBleBackend` drives the host machine's adapter through the bundled `cn1-ble-helper` process. Ports swap engines behind this interface.

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Interface
  Description
  `static interface`
  `BleBackend.AdapterStateSink`
  Observes adapter state transitions of this backend.
  `static interface`
  `BleBackend.ScanSink`
  Receives the sightings of the single platform scan.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `AdapterState`
  `getAdapterState()`
  `List<BlePeripheral>`
  `getBondedPeripherals()`
  `List<BlePeripheral>`
  `getConnectedPeripherals(BluetoothUuid serviceFilter)`
  `String`
  `getName()`
  A stable identifier, e.g.
  `BlePeripheral`
  `getPeripheral(String address)`
  The canonical peripheral at the address, or `null`.
  `boolean`
  `isClassicSupported()`
  `boolean`
  `isL2capSupported()`
  `boolean`
  `isLeSupported()`
  `boolean`
  `isPeripheralModeSupported()`
  `AsyncResource<GattServer>`
  `openGattServer(GattServerListener listener)`
  `AsyncResource<L2capServer>`
  `openL2capServer(boolean secure)`
  `void`
  `setAdapterStateSink(BleBackend.AdapterStateSink sink)`
  Registers the single adapter-state observer (the port owner).
  `void`
  `shutdown()`
  Releases backend resources when it is switched away.
  `AsyncResource<BleAdvertisement>`
  `startAdvertising(AdvertiseSettings settings, AdvertiseData data, AdvertiseData scanResponse)`
  `void`
  `startScan(BleBackend.ScanSink sink)`
  Starts the single platform scan; sightings flow into the sink.
  `void`
  `stopScan()`
  Stops the platform scan.

- ## Method Details

  - ### getName

    String getName()
    A stable identifier, e.g. `"simulator"` or `"native"`.

  - ### isLeSupported

    boolean isLeSupported()

  - ### isPeripheralModeSupported

    boolean isPeripheralModeSupported()

  - ### isClassicSupported

    boolean isClassicSupported()

  - ### isL2capSupported

    boolean isL2capSupported()

  - ### getAdapterState

    AdapterState getAdapterState()

  - ### setAdapterStateSink

    void setAdapterStateSink(BleBackend.AdapterStateSink sink)
    Registers the single adapter-state observer (the port owner).

  - ### startScan

    void startScan(BleBackend.ScanSink sink)
    Starts the single platform scan; sightings flow into the sink.

  - ### stopScan

    void stopScan()
    Stops the platform scan.

  - ### getPeripheral

    BlePeripheral getPeripheral(String address)
    The canonical peripheral at the address, or `null`.

  - ### getConnectedPeripherals

    List<BlePeripheral> getConnectedPeripherals(BluetoothUuid serviceFilter)

  - ### getBondedPeripherals

    List<BlePeripheral> getBondedPeripherals()

  - ### openGattServer

    AsyncResource<GattServer> openGattServer(GattServerListener listener)

  - ### startAdvertising

    AsyncResource<BleAdvertisement> startAdvertising(AdvertiseSettings settings, AdvertiseData data, AdvertiseData scanResponse)

  - ### openL2capServer

    AsyncResource<L2capServer> openL2capServer(boolean secure)

  - ### shutdown

    void shutdown()
    Releases backend resources when it is switched away.