# Class HelperBluetooth

java.lang.Object
com.codename1.bluetooth.Bluetooth
com.codename1.bluetooth.helper.HelperBluetooth

public class HelperBluetooth extends Bluetooth

A `Bluetooth` entry point backed by the `cn1-ble-helper` subprocess -- the shared implementation for the native Win32 and Linux desktop ports. Those ports have no `java.lang.ProcessBuilder`, so they pass a `HelperTransportFactory` built on their native process bridge (see `NativeSubprocessTransport`); this class wires it into a `HelperBleBackend` and exposes real BLE central (scan / connect / GATT client / notifications). btleplug -- the helper's backend -- is central-only, so peripheral mode, L2CAP and classic Bluetooth report unsupported.

A port creates one instance in its `getBluetooth()` and calls `shutdown()` on app exit.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `HelperBluetooth(HelperTransportFactory transportFactory)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `AdapterState`
  `getAdapterState()`
  The current state of the local adapter.
  `BluetoothLE`
  `getLE()`
  The BLE central role entry point -- scanning, connections, GATT client.
  `boolean`
  `hasPermission(BluetoothPermission permission)`
  Desktop Linux/Windows have no app-level runtime Bluetooth permission (access is governed by the OS/user session), so permissions are reported granted and requests resolve `true`.
  `boolean`
  `isClassicSupported()`
  `true` when classic Bluetooth (discovery, RFCOMM) is available.
  `boolean`
  `isL2capSupported()`
  `true` when L2CAP connection-oriented channels are available (Android 10+, iOS 11+).
  `boolean`
  `isLeSupported()`
  `true` when the BLE central role (scanning, connections, GATT client) is available.
  `boolean`
  `isPeripheralModeSupported()`
  `true` when the BLE peripheral role (advertising and a local GATT server) is available.
  `boolean`
  `isSupported()`
  `true` when this port/device exposes any Bluetooth functionality at all.
  `AsyncResource<Boolean>`
  `requestEnable()`
  There is no programmatic adapter-enable on the desktop helper path; resolves `true` when the adapter is already powered on, else `false`.
  `AsyncResource<Boolean>`
  `requestPermissions(BluetoothPermission... permissions)`
  Requests the given runtime permissions, prompting the user where needed.
  `void`
  `shutdown()`
  Tears down the helper subprocess.

  ### Methods inherited from class Bluetooth

  `addAdapterStateListener, fireAdapterStateChanged, getClassic, getInstance, isEnabled, removeAdapterStateListener`

  ### Methods inherited from class Object

  `clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### HelperBluetooth

    public HelperBluetooth(HelperTransportFactory transportFactory)

- ## Method Details

  - ### isSupported

    public boolean isSupported()
    Description copied from class: `Bluetooth`
    `true` when this port/device exposes any Bluetooth functionality at all. Returns `false` on the fallback base class.
    Overrides:
      `isSupported` in class `Bluetooth`

  - ### isLeSupported

    public boolean isLeSupported()
    Description copied from class: `Bluetooth`
    `true` when the BLE central role (scanning, connections, GATT client) is available. Defaults to `false`.
    Overrides:
      `isLeSupported` in class `Bluetooth`

  - ### isClassicSupported

    public boolean isClassicSupported()
    Description copied from class: `Bluetooth`
    `true` when classic Bluetooth (discovery, RFCOMM) is available. Always `false` on iOS, which does not expose classic Bluetooth to apps. Defaults to `false`.
    Overrides:
      `isClassicSupported` in class `Bluetooth`

  - ### isPeripheralModeSupported

    public boolean isPeripheralModeSupported()
    Description copied from class: `Bluetooth`
    `true` when the BLE peripheral role (advertising and a local GATT server) is available. `false` on tvOS/watchOS and on the JavaScript port. Defaults to `false`.
    Overrides:
      `isPeripheralModeSupported` in class `Bluetooth`

  - ### isL2capSupported

    public boolean isL2capSupported()
    Description copied from class: `Bluetooth`
    `true` when L2CAP connection-oriented channels are available (Android 10+, iOS 11+). Defaults to `false`.
    Overrides:
      `isL2capSupported` in class `Bluetooth`

  - ### getAdapterState

    public AdapterState getAdapterState()
    Description copied from class: `Bluetooth`
    The current state of the local adapter. The fallback base class reports `AdapterState.UNSUPPORTED`.
    Overrides:
      `getAdapterState` in class `Bluetooth`

  - ### getLE

    public BluetoothLE getLE()
    Description copied from class: `Bluetooth`
    The BLE central role entry point -- scanning, connections, GATT client. Never `null`: on ports without BLE a no-op instance is returned whose operations fail fast with `BluetoothError.NOT_SUPPORTED`; branch via `Bluetooth.isLeSupported()`.
    Overrides:
      `getLE` in class `Bluetooth`

  - ### hasPermission

    public boolean hasPermission(BluetoothPermission permission)
    Desktop Linux/Windows have no app-level runtime Bluetooth permission (access is governed by the OS/user session), so permissions are reported granted and requests resolve `true`.
    Overrides:
      `hasPermission` in class `Bluetooth`

  - ### requestPermissions

    public AsyncResource<Boolean> requestPermissions(BluetoothPermission... permissions)
    Description copied from class: `Bluetooth`
    Requests the given runtime permissions, prompting the user where needed. Resolves `true` when every requested permission is granted. Resolves `false` (rather than failing) when denied or when the platform has no Bluetooth support at all.
    Overrides:
      `requestPermissions` in class `Bluetooth`

  - ### requestEnable

    public AsyncResource<Boolean> requestEnable()
    There is no programmatic adapter-enable on the desktop helper path; resolves `true` when the adapter is already powered on, else `false`.
    Overrides:
      `requestEnable` in class `Bluetooth`

  - ### shutdown

    public void shutdown()
    Tears down the helper subprocess. Call from the port on app exit.