/** * Adapt an in-memory {@link DeviceHandle} simulator to the * `serialport`-style {@link SerialLike} that {@link attachBridge} consumes, so a * test can expose a *simulated* device over a WebSocket and have a real app * connect to it with `new WebSocketSerialTransport(url)`. This is what makes the * *same* device-driving test run in Jest (in-memory) and on a device/emulator * (over the socket). * * Pure — no `ws`/`serialport`/Node imports — so it unit-tests with the same * `FakeWs` + `attachBridge` fakes the bridge core uses. The lazy-`ws` server * wrapper lives in `react-native-web-serial-api/testing` (`exposeSimulatedDevice`). * * Mapping (host app ⇄ simulator): * - client binary frame → `write` → `device.onData`, * - `setLineCoding`/`setBaudRate` → `update` → opens the sim + starts reading, * - `setSignals` → `set` → `device.onHostSignals`, * - `getSignals` → `get` → the device's asserted input signals, * - `device.send(...)` → `'data'` → client binary frame, * - `getPortInfo` → {@link portInfoFromDevice}. */ import type { DeviceHandle, InMemorySerialTransport } from '../testing/in-memory-serial-transport'; import type { SerialLike } from './bridge'; import type { PortInfo } from './protocol'; /** The bridge's `getPortInfo` metadata, taken from the device's USB identity. */ export declare function portInfoFromDevice(device: DeviceHandle): PortInfo; /** * Build a {@link SerialLike} backed by `device` (already registered on * `transport` via `addDevice`). One adapter per WebSocket connection; its * transport subscriptions are released when the bridge tears down its listeners. */ export declare function SimulatedDeviceToSerialLike(transport: InMemorySerialTransport, device: DeviceHandle): SerialLike; //# sourceMappingURL=serial-device-bridge.d.ts.map