/** * Typed shim over @mnlphlp/plugin-blec. * * The rest of this package only talks to the `PluginBlecApi` interface so * plugin-blec can be mocked in tests and (one day) swapped for an alternative * Tauri BLE plugin without touching consumers. */ export interface BleDeviceInfo { address: string; name: string; rssi: number; isConnected: boolean; isBonded: boolean; services: string[]; manufacturerData: Record; serviceData: Record; } export type WriteType = 'withResponse' | 'withoutResponse'; export interface BleGattServiceInfo { uuid: string; characteristics: Array<{ uuid: string; descriptors: string[]; properties: number; }>; } export interface PluginBlecApi { /** * `askIfDenied=true` triggers the system permission dialog if the app does * not already have the permissions. Android 11 and older also request the * location permission required by the platform for BLE discovery. */ checkPermissions: (askIfDenied?: boolean) => Promise; startScan: (handler: (devices: BleDeviceInfo[]) => void, timeoutMs: number) => Promise; stopScan: () => Promise; /** * Connect to a device. Connecting to a new address does not disconnect any * other address that's already connected — the fork this package is * pinned to (`0xNullAI/tauri-plugin-blec-multi`) tracks each connection * independently, so a Coyote client and an Opossum/sensor client can stay * connected at the same time. */ connect: (address: string, onDisconnect: (() => void) | null) => Promise; /** * `address` is optional only for backward compatibility with the * upstream single-connection API — it rejects with `AmbiguousDevice` if * omitted while 2+ devices are connected. Every call in this package * passes it explicitly (each `PluginBlecCharacteristic`/`TauriBlecDeviceClient` * instance is scoped to one address) so that never happens here. */ disconnect: (address?: string) => Promise; /** List every currently-connected device, across all addresses. */ connectedDevices: () => Promise; /** * Discover a candidate's GATT services. The native plugin temporarily * connects and disconnects when the device is not already connected. */ listServices: (address: string) => Promise; /** * Per-device connection state stream. Unlike a hypothetical aggregate * "connected" flag, this only fires for `address`, so it stays correct * when multiple devices are connected concurrently. */ getDeviceConnectionUpdates: (address: string, handler: (connected: boolean) => void) => Promise; send: (characteristic: string, data: number[], writeType?: WriteType, service?: string, address?: string) => Promise; read: (characteristic: string, service?: string, address?: string) => Promise; subscribe: (characteristic: string, service: string | null, handler: (data: number[]) => void, address?: string) => Promise; unsubscribe: (characteristic: string, service?: string, address?: string) => Promise; /** MTU of a connected device, in bytes. */ getMtu: (address?: string) => Promise; /** Request the Android BLE MTU used by the DG-LAB Opossum protocol. */ setAndroidMtu?: (mtu: number) => Promise; } export declare function __setPluginBlecForTests(api: PluginBlecApi | undefined): void; export declare function resolvePluginBlec(): Promise; //# sourceMappingURL=plugin-blec.d.ts.map