Skip to content

BleHooks

Defined in: src/transports/bleTransport.ts:15

I/O hooks the caller binds to their BLE library (noble, react-native-ble-plx, …).

subscribe(onBytes): void;

Defined in: src/transports/bleTransport.ts:26

Register a notification handler for the TX characteristic. Each notification delivered to onBytes is ONE complete companion frame (no framing on BLE).

ParameterType
onBytes(frame) => void

void


optional watchState(onState): void;

Defined in: src/transports/bleTransport.ts:28

Optional: map connect/disconnect to transport state.

ParameterType
onState(s) => void

void


write(bytes): void | Promise<void>;

Defined in: src/transports/bleTransport.ts:21

Write one companion frame to the RX characteristic. Callers receive raw bytes; encode as your BLE library requires (e.g. base64 for react-native-ble-plx, Buffer/Uint8Array for noble).

ParameterType
bytesUint8Array

void | Promise<void>