# Package com.codename1.bluetooth.helper

package com.codename1.bluetooth.helper

Shared implementation support for the ports that talk to the native `cn1-ble-helper` subprocess (JavaSE real-hardware, Win32 and Linux). Not part of the public Bluetooth API -- application code uses `com.codename1.bluetooth` and its sub packages instead.

`HelperBleBackend` implements the BLE central protocol over a line-delimited JSON transport, `HelperBluetooth`/`HelperBluetoothLE` bridge it onto the core facades, and `Wire` is the codec. `HelperTransport` abstracts the subprocess pipe so each port supplies its own launcher -- `ProcessBuilder` on JavaSE, a native `posix_spawn`/`CreateProcess` bridge on the C-translated Win32/Linux ports (`NativeSubprocessTransport`).

- Related Packages
  Package
  Description
  com.codename1.bluetooth
  Cross-platform Bluetooth API: adapter state, runtime permissions and capability queries.
  com.codename1.bluetooth.classic
  Classic Bluetooth (BR/EDR): inquiry discovery (`ClassicDiscovery`), bonded-device listing and RFCOMM stream connections (`RfcommConnection`, `RfcommServer`).
  com.codename1.bluetooth.gatt
  The client-side GATT model discovered on a remote peripheral: `GattService`, `GattCharacteristic` (read/write/subscribe), `GattDescriptor`, notification listeners and ATT status codes.
  com.codename1.bluetooth.le
  BLE central role: scanning (`BluetoothLE`, `ScanSettings`, `ScanFilter`, `ScanResult`, `BleScan`), connections and the GATT client (`BlePeripheral`, connection events) and L2CAP connection-oriented channels (`L2capChannel`, `L2capServer`).
- Class
  Description
  BleBackend
  The pluggable BLE engine seam.
  BleBackend.AdapterStateSink
  Observes adapter state transitions of this backend.
  BleBackend.ScanSink
  Receives the sightings of the single platform scan.
  HelperBleBackend
  The real-radio `BleBackend`: drives the host machine's Bluetooth adapter through the bundled `cn1-ble-helper` subprocess (a Rust btleplug bridge -- CoreBluetooth on macOS, BlueZ on Linux, WinRT on Windows).
  HelperBleBackend.PendingOp
  Completion of one in-flight helper command.
  HelperBlePeripheral
  Real-radio `BlePeripheral` bridging the core GATT client contract onto `cn1-ble-helper` commands.
  HelperBluetooth
  A `Bluetooth` entry point backed by the `cn1-ble-helper` subprocess -- the shared implementation for the native Win32 and Linux desktop ports.
  HelperTransport
  The abstraction over the `cn1-ble-helper` child process's standard I/O.
  HelperTransportFactory
  Creates `HelperTransport` instances so `HelperBleBackend` can (re)start the helper on activation and after a restart.
  NativeSubprocessTransport
  A `HelperTransport` over a native child process, for the ports that have no `java.lang.ProcessBuilder` (the native Win32 and Linux desktop ports).
  NativeSubprocessTransportFactory
  Builds `NativeSubprocessTransport`s for a native port.
  Wire
  The line-delimited JSON codec of the `cn1-ble-helper` protocol: command serialization (with escaping) and event-line parsing via `JSONParser`, with Base64-encoded characteristic/descriptor payloads.
  Wire.Obj
  Builder for one command line.