import type { WebBluetoothConnectionContext } from './base.js'; import type { BluetoothRemoteGATTCharacteristicLike, BluetoothRemoteGATTServerLike } from './types.js'; /** * Shared GATT write with a fallback chain across the three write methods a * characteristic might expose. Standalone (not a class method) so every * 47L12x-family adapter can call it without needing to extend * `BaseCoyoteProtocolAdapter` — Coyote, paw-prints, civet-edging, and * opossum all share this exact write behavior even though their command * shapes differ. */ export declare function writeCharacteristicValue(characteristic: BluetoothRemoteGATTCharacteristicLike, value: ArrayBufferView | ArrayBuffer, options?: { preferResponse?: boolean; }): Promise; /** * Newer firmware (flashed via the official app) ignores normal control * writes on the 0x180C/0x150A characteristic until it has seen the same * connect-time sequence the app always sends: an init packet, best-effort * subscription to two legacy/OTA notify channels, and an MTU bump to 140. * * The official app sends this exact same init packet unconditionally to * every 47L12x-family device it connects to — Coyote, paw-prints, * civet-edging, and opossum all share the identical 0x180C GATT skeleton — * old and new firmware alike, with no firmware-version detection gating it. * So this needs to run for all four device adapters, not just Coyote V3; * originally it only ran there, which reproduced the exact "device won't * respond" symptom for the three newer device kinds. Every step is * best-effort/non-fatal, including the init write itself: if any step fails * on a real device this hasn't been tested against, the caller's normal * control writes still proceed rather than the connection being refused. */ export declare function performV3FamilyConnectHandshake(server: BluetoothRemoteGATTServerLike, writeChar: BluetoothRemoteGATTCharacteristicLike): Promise; /** * The 47L12x-family indicator LED is a discrete 8-color enum, not a * continuous byte — confirmed against the community protocol doc's * paw-prints color table (0=熄灭/off, 1=黄, 2=红, 3=紫, 4=蓝, 5=青, 6=绿, * 7=白) and consistent with civet-edging's one documented example * ("01为黄色" — matches index 1 in that same table). Values 8-255 have no * defined meaning on real hardware, so every adapter clamps here rather * than trusting the caller (a stray remote-control byte or a naive 0-255 * color picker would otherwise reach the wire unclamped). */ export declare function clampIndicatorColor(color: number): number; /** * Generic clamp-to-integer-range, non-finite input falling back to `min`. * Shared by `BaseCoyoteProtocolAdapter` and `OpossumVibrateAdapter` — both * clamp raw strength/waveform bytes the identical way before they reach the * wire. */ export declare function clampNumber(value: number, min: number, max: number): number; export interface SensorGattConnection { writeChar: BluetoothRemoteGATTCharacteristicLike; notifyChar: BluetoothRemoteGATTCharacteristicLike; deviceName: string; address: string; battery: number; } /** * Shared connect sequence for the sensor-family adapters (paw-prints, * civet-edging): open the shared 0x180C write/notify characteristics, wire * the notification listener, run the V3-family handshake, then a * best-effort battery read. Both adapters had this exact sequence * byte-for-byte duplicated before this was extracted — kept as a plain * function (not a base class) so each adapter's own `onConnected` keeps * full control over how/when it constructs and emits its `SensorState`, * which differs subtly between them (e.g. paw-prints resets stale chars * before a fresh attempt; civet-edging auto-starts pressure streaming right * after) and shouldn't be forced into a shared shape. */ export declare function connectSensorGatt(context: WebBluetoothConnectionContext, onNotification: (event: Event) => void): Promise; /** * Shared teardown counterpart to `connectSensorGatt` — removes the * notification listener and best-effort stops notifications. Safe to call * with `notifyChar: null` (e.g. disconnecting before a connection attempt * ever got this far). */ export declare function disconnectSensorGatt(notifyChar: BluetoothRemoteGATTCharacteristicLike | null, onNotification: (event: Event) => void): Promise; //# sourceMappingURL=gatt-utils.d.ts.map