import { type BluetoothDeviceLike, type BluetoothRemoteGATTServerLike, type GattReadyRetryOptions, type NavigatorBluetoothLike, type RequestDeviceOptionsLike, type WebBluetoothConnectionContext } from '@dg-kit/protocol'; /** Minimal shape both `OpossumVibrateAdapter` and the sensor adapters satisfy. */ export interface ConnectableAdapter { onConnected(context: WebBluetoothConnectionContext): Promise; onDisconnected(): Promise; } export interface AuxDeviceConnectOptions { navigatorRef?: NavigatorBluetoothLike; requestDeviceOptions: RequestDeviceOptionsLike; /** * Tuning for the GATT-not-ready retry wrapped around `adapter.onConnected()` * — see `runWithGattReadyRetry`'s doc (`@dg-kit/protocol`). These three * device kinds share the exact same GATT skeleton as Coyote, so they hit * the identical "gatt.connect() resolves before service discovery" * Web Bluetooth race. Defaults are fine for normal use; exposed mainly for * tests. */ gattReadyRetryOptions?: GattReadyRetryOptions; } /** * Opens the Bluetooth chooser scoped to `options.requestDeviceOptions`, * connects GATT, and hands the connection to `adapter.onConnected()`. * Mirrors `WebBluetoothDeviceClient.connect()`'s "replace the previous * device only after the new one succeeds" ordering, minus the reconnect * bookkeeping that client also carries. * * Returns the newly connected device; the caller is responsible for storing * it and passing it back in on the next call (as `previousDevice`) and to * `disconnectAuxDevice`. */ export declare function connectAuxDevice(options: AuxDeviceConnectOptions, adapter: ConnectableAdapter, previousDevice: BluetoothDeviceLike | null, onGattDisconnected: (event: Event) => void): Promise; /** * Attaches to an already-obtained `(device, server)` pair instead of * running this helper's own `bluetooth.requestDevice()` chooser prompt — * the aux-device counterpart to `WebBluetoothDeviceClient.connectDevice()`. * Lets a caller that already ran ONE shared chooser scoped to every DG-Lab * device kind (see `requestDgLabDevice()`) and identified the picked * device's kind via `detectDeviceKind()` hand it straight to the matching * client, instead of needing a second, kind-scoped chooser prompt. * `gatt.connect()` must already have been called by the caller; this only * runs the adapter handshake and the same replace-previous-device * bookkeeping `connectAuxDevice()` does. */ export declare function attachAuxDevice(nextDevice: BluetoothDeviceLike, server: BluetoothRemoteGATTServerLike, adapter: ConnectableAdapter, previousDevice: BluetoothDeviceLike | null, onGattDisconnected: (event: Event) => void, gattReadyRetryOptions?: GattReadyRetryOptions): Promise; /** * User-initiated disconnect: removes the listener BEFORE calling * `gatt.disconnect()` so the resulting `gattserverdisconnected` event never * reaches `onGattDisconnected` a second time. */ export declare function disconnectAuxDevice(device: BluetoothDeviceLike | null, adapter: ConnectableAdapter, onGattDisconnected: (event: Event) => void): Promise; //# sourceMappingURL=aux-device-connect.d.ts.map