# Class HelperBlePeripheral

java.lang.Object
com.codename1.bluetooth.BluetoothDevice
com.codename1.bluetooth.le.BlePeripheral
com.codename1.bluetooth.helper.HelperBlePeripheral

public class HelperBlePeripheral extends BlePeripheral

Real-radio `BlePeripheral` bridging the core GATT client contract onto `cn1-ble-helper` commands. One canonical instance exists per address (cached by `HelperBleBackend`), so discovered `GattCharacteristic` objects stay identical across the scan/connect/notify lifecycle.

btleplug constraints surface here: no bonding (`doCreateBond(AsyncResource)`), no L2CAP (`doOpenL2cap(int, boolean, AsyncResource)`), no MTU negotiation (`doRequestMtu(int, AsyncResource)` resolves with the current value), no connection-priority hints, and RSSI reads answer with the last advertisement sighting.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `protected void`
  `doConnect(ConnectionOptions options, AsyncResource<BlePeripheral> out)`
  Establishes the platform connection and completes/fails `out`.
  `protected void`
  `doCreateBond(AsyncResource<Boolean> out)`
  Initiates bonding and completes `out` when the bond state settles.
  `protected void`
  `doDisconnect()`
  Tears down the platform connection; `BlePeripheral.fireConnectionStateChanged(ConnectionState, BluetoothException)` reports the resulting `DISCONNECTED` transition.
  `protected void`
  `doDiscoverServices(AsyncResource<List<GattService>> out)`
  Performs service discovery and completes `out` with the discovered `GattService` list (constructed via the public gatt-package constructors).
  `protected void`
  `doOpenL2cap(int psm, boolean secure, AsyncResource<L2capChannel> out)`
  Opens an L2CAP channel and completes `out` with it.
  `protected void`
  `doReadCharacteristic(GattCharacteristic c, AsyncResource<byte[]> out)`
  Reads a characteristic and completes `out` with its value.
  `protected void`
  `doReadDescriptor(GattDescriptor d, AsyncResource<byte[]> out)`
  Reads a descriptor and completes `out` with its value.
  `protected void`
  `doReadRssi(AsyncResource<Integer> out)`
  Reads the connection RSSI and completes `out`.
  `protected void`
  `doRequestConnectionPriority(ConnectionPriority priority, AsyncResource<Boolean> out)`
  Requests a connection-interval preference and completes `out`.
  `protected void`
  `doRequestMtu(int mtu, AsyncResource<Integer> out)`
  Requests an MTU and completes `out` with the granted value.
  `protected void`
  `doSetNotifications(GattCharacteristic c, boolean enable, boolean indication, AsyncResource<Boolean> out)`
  Arms or disarms notifications/indications (including the CCCD write) and completes `out` once done.
  `protected void`
  `doWriteCharacteristic(GattCharacteristic c, byte[] value, boolean withResponse, AsyncResource<Boolean> out)`
  Writes a characteristic and completes `out` once acknowledged (`withResponse`) or queued to the controller.
  `protected void`
  `doWriteDescriptor(GattDescriptor d, byte[] value, AsyncResource<Boolean> out)`
  Writes a descriptor and completes `out` once acknowledged.
  `String`
  `getAddress()`
  A stable identifier for this device: the MAC address on Android and the desktop ports (`AA:BB:CC:DD:EE:FF`), but the per-app CoreBluetooth identifier UUID string on iOS.
  `BondState`
  `getBondState()`
  The current pairing state of this device; defaults to `BondState.NONE`.
  `String`
  `getName()`
  The advertised or cached device name; may be `null` when the device never advertised one.
  `DeviceType`
  `getType()`
  The transport family of this device; defaults to `DeviceType.UNKNOWN`.
  `static int`
  `propertiesMask(List<Object> names)`
  Maps the wire property names onto the GattCharacteristic bits.

  ### Methods inherited from class BlePeripheral

  `addConnectionListener, connect, connect, createBond, disconnect, discoverServices, fireConnectionStateChanged, fireNotification, fireServicesInvalidated, getCharacteristic, getConnectionState, getMtu, getService, getServices, isSubscribed, openL2capChannel, readCharacteristic, readDescriptor, readRssi, removeConnectionListener, requestConnectionPriority, requestMtu, setMtu, setOperationTimeout, subscribe, unsubscribe, writeCharacteristic, writeDescriptor`

  ### Methods inherited from class BluetoothDevice

  `equals, hashCode, toString`

  ### Methods inherited from class Object

  `clone, getClass, notify, notifyAll, wait, wait, wait`

- ## Method Details

  - ### getAddress

    public String getAddress()
    Description copied from class: `BluetoothDevice`
    A stable identifier for this device: the MAC address on Android and the desktop ports (`AA:BB:CC:DD:EE:FF`), but the per-app CoreBluetooth identifier UUID string on iOS. The value is stable for this app on this device and safe to persist for reconnection on the same install, but it is NOT portable across phones or platforms -- never treat it as the peripheral's real hardware address.
    Specified by:
      `getAddress` in class `BluetoothDevice`

  - ### getName

    public String getName()
    Description copied from class: `BluetoothDevice`
    The advertised or cached device name; may be `null` when the device never advertised one.
    Specified by:
      `getName` in class `BluetoothDevice`

  - ### getType

    public DeviceType getType()
    Description copied from class: `BluetoothDevice`
    The transport family of this device; defaults to `DeviceType.UNKNOWN`.
    Overrides:
      `getType` in class `BluetoothDevice`

  - ### getBondState

    public BondState getBondState()
    Description copied from class: `BluetoothDevice`
    The current pairing state of this device; defaults to `BondState.NONE`. iOS manages bonds internally and usually reports `BondState.NONE` -- see `BondState`.
    Overrides:
      `getBondState` in class `BluetoothDevice`

  - ### doConnect

    protected void doConnect(ConnectionOptions options, AsyncResource<BlePeripheral> out)
    Description copied from class: `BlePeripheral`
    Establishes the platform connection and completes/fails `out`.
    Specified by:
      `doConnect` in class `BlePeripheral`

  - ### doDisconnect

    protected void doDisconnect()
    Description copied from class: `BlePeripheral`
    Tears down the platform connection; `BlePeripheral.fireConnectionStateChanged(ConnectionState, BluetoothException)` reports the resulting `DISCONNECTED` transition.
    Specified by:
      `doDisconnect` in class `BlePeripheral`

  - ### doDiscoverServices

    protected void doDiscoverServices(AsyncResource<List<GattService>> out)
    Description copied from class: `BlePeripheral`
    Performs service discovery and completes `out` with the discovered `GattService` list (constructed via the public gatt-package constructors).
    Specified by:
      `doDiscoverServices` in class `BlePeripheral`

  - ### propertiesMask

    public static int propertiesMask(List<Object> names)
    Maps the wire property names onto the GattCharacteristic bits.

  - ### doReadCharacteristic

    protected void doReadCharacteristic(GattCharacteristic c, AsyncResource<byte[]> out)
    Description copied from class: `BlePeripheral`
    Reads a characteristic and completes `out` with its value.
    Specified by:
      `doReadCharacteristic` in class `BlePeripheral`

  - ### doWriteCharacteristic

    protected void doWriteCharacteristic(GattCharacteristic c, byte[] value, boolean withResponse, AsyncResource<Boolean> out)
    Description copied from class: `BlePeripheral`
    Writes a characteristic and completes `out` once acknowledged (`withResponse`) or queued to the controller.
    Specified by:
      `doWriteCharacteristic` in class `BlePeripheral`

  - ### doReadDescriptor

    protected void doReadDescriptor(GattDescriptor d, AsyncResource<byte[]> out)
    Description copied from class: `BlePeripheral`
    Reads a descriptor and completes `out` with its value.
    Specified by:
      `doReadDescriptor` in class `BlePeripheral`

  - ### doWriteDescriptor

    protected void doWriteDescriptor(GattDescriptor d, byte[] value, AsyncResource<Boolean> out)
    Description copied from class: `BlePeripheral`
    Writes a descriptor and completes `out` once acknowledged.
    Specified by:
      `doWriteDescriptor` in class `BlePeripheral`

  - ### doSetNotifications

    protected void doSetNotifications(GattCharacteristic c, boolean enable, boolean indication, AsyncResource<Boolean> out)
    Description copied from class: `BlePeripheral`
    Arms or disarms notifications/indications (including the CCCD write) and completes `out` once done.
    Specified by:
      `doSetNotifications` in class `BlePeripheral`

  - ### doReadRssi

    protected void doReadRssi(AsyncResource<Integer> out)
    Description copied from class: `BlePeripheral`
    Reads the connection RSSI and completes `out`.
    Specified by:
      `doReadRssi` in class `BlePeripheral`

  - ### doRequestMtu

    protected void doRequestMtu(int mtu, AsyncResource<Integer> out)
    Description copied from class: `BlePeripheral`
    Requests an MTU and completes `out` with the granted value.
    Specified by:
      `doRequestMtu` in class `BlePeripheral`

  - ### doRequestConnectionPriority

    protected void doRequestConnectionPriority(ConnectionPriority priority, AsyncResource<Boolean> out)
    Description copied from class: `BlePeripheral`
    Requests a connection-interval preference and completes `out`.
    Specified by:
      `doRequestConnectionPriority` in class `BlePeripheral`

  - ### doCreateBond

    protected void doCreateBond(AsyncResource<Boolean> out)
    Description copied from class: `BlePeripheral`
    Initiates bonding and completes `out` when the bond state settles.
    Specified by:
      `doCreateBond` in class `BlePeripheral`

  - ### doOpenL2cap

    protected void doOpenL2cap(int psm, boolean secure, AsyncResource<L2capChannel> out)
    Description copied from class: `BlePeripheral`
    Opens an L2CAP channel and completes `out` with it. Called directly (not through the operation queue).
    Specified by:
      `doOpenL2cap` in class `BlePeripheral`