import { B as BaseProfile } from '../base-n3IBbs7i.mjs'; import '../error-taxonomy-CWrJx3aZ.mjs'; /** * Service UUIDs a Nordic UART device may reach after connection (the single NUS * service). Use with `optionalServices` / `Beacio.registerServices`, or via * {@link deriveOptionalServices} given {@link NordicUARTProfile}. */ declare const NUS_SERVICES: readonly string[]; /** * Nordic UART Service (NUS) profile — a bidirectional serial-over-BLE pipe. * * The de-facto standard "UART service" exposed by Espruino devices * (Bangle.js, Puck.js, Pixl.js, MDBT42Q), the BBC micro:bit, and Adafruit * Bluefruit modules. Data flows over two characteristics on the NUS service * `6e400001-b5a3-f393-e0a9-e50e24dcca9e`: * * - **TX** `6e400003-…` — device -> host, delivered via notifications. * Enabled through {@link BaseProfile.subscribe} (the native layer owns the * CCCD descriptor; `startNotifications()` covers notify *and* indicate). * - **RX** `6e400002-…` — host -> device, sent with write-without-response and * chunked to the negotiated MTU. * * Strictly W3C `navigator.bluetooth` GATT: this profile never reads or writes * a CCCD/SCCD descriptor itself. * * @example * ```ts * import { NordicUARTProfile, deriveOptionalServices } from '@beacio/core/profiles'; * * // Declare the service from the profile — no hand-copied UUID: * // requestDevice({ filters: [{ namePrefix: 'Puck.js' }], * // optionalServices: deriveOptionalServices(NordicUARTProfile) }) * const uart = new NordicUARTProfile(device); * await uart.connect(); * * const decoder = new TextDecoder(); * const unsubscribe = uart.onReceive((chunk) => { * process.stdout.write(decoder.decode(chunk)); * }); * * await uart.send(new TextEncoder().encode('LED1.set()\n')); * * unsubscribe(); * uart.stop(); * ``` */ declare class NordicUARTProfile extends BaseProfile { /** Services this profile's device may reach after connection (the NUS service). Read by {@link deriveOptionalServices}. */ static readonly services: readonly string[]; protected readonly service = "6e400001-b5a3-f393-e0a9-e50e24dcca9e"; /** * Subscribe to inbound data from the device (TX characteristic, notify). * Each notification is delivered as a raw {@link DataView} chunk. * * @param callback - Invoked with every inbound chunk. * @returns Unsubscribe function. Also cleaned up by {@link BaseProfile.stop}. */ onReceive(callback: (chunk: DataView) => void): () => void; /** * Send data to the device (RX characteristic, write-without-response). * Payloads larger than the negotiated write-without-response limit are * split into MTU-sized chunks and written sequentially. * * @param data - Bytes to send. Accepts any {@link BufferSource}. */ send(data: BufferSource): Promise; } export { NUS_SERVICES, NordicUARTProfile };