import type { AdvertisementObservation, ScanOptions } from '../backend-contract/advertisement.js'; import { type CleanupRecord } from '../backend-contract/errors.js'; import type { BackendIdentity } from '../backend-contract/identity.js'; import type { CharacteristicPath } from '../backend-contract/gatt.js'; import type { PublicOperationOptions, SubscriptionOptions } from '../backend-contract/operations.js'; import { type OwnedBytes, type PeerId, type Uuid } from '../backend-contract/primitives.js'; import { BleManager, Connection, DiscoveredGattDatabase } from './ble-manager.js'; type CurrentCharacteristicPath = CharacteristicPath; /** The exact public scan request and observation predicate used by find and scanUntil. */ export interface ScanUntilOptions { readonly scan: ScanOptions; readonly matches: (observation: AdvertisementObservation) => boolean; } /** A discovered, generation-bound GATT database that remains owned by its returned connection. */ export interface ConnectedGattDatabase> { readonly connection: Connection; readonly database: DiscoveredGattDatabase; readonly snapshot: Awaited['snapshot']>>; } /** Bounded collection configuration for collectNotifications. */ export interface CollectNotificationsOptions { readonly subscription: SubscriptionOptions; readonly maximumValues: number; } /** * Scans until a caller-owned predicate accepts an observation. The exact scan * request, including active AbortSignal and deadline behavior, is forwarded * unchanged to the public manager. */ export declare function scanUntil>(manager: BleManager, options: ScanUntilOptions): Promise>; /** Alias for scanUntil that keeps the public vocabulary compact. */ export declare function find>(manager: BleManager, options: ScanUntilOptions): Promise>; /** Connects and discovers through the public handles, releasing a partial connection if discovery fails. */ export declare function connectAndDiscover>(manager: BleManager, peerId: PeerId, options: PublicOperationOptions): Promise>; /** Resolves the first notification value and removes the subscription before returning. */ export declare function firstNotification>(database: DiscoveredGattDatabase, path: CurrentCharacteristicPath, options: SubscriptionOptions): Promise; /** Collects no more than maximumValues notification payloads, then removes the subscription. */ export declare function collectNotifications>(database: DiscoveredGattDatabase, path: CurrentCharacteristicPath, options: CollectNotificationsOptions): Promise; /** Runs an operation with one connection lease and deterministically releases that lease on every exit. */ export declare function withConnection, Value>(manager: BleManager, peerId: PeerId, options: PublicOperationOptions, operation: (connection: Connection) => Promise): Promise; export declare function defaultScanDelivery(): Readonly<{ itemCapacity: import("../backend-contract/primitives.js").Capacity; byteCapacity: import("../backend-contract/primitives.js").Capacity; reservedControlCapacity: import("../backend-contract/primitives.js").Capacity; overflowPolicy: "drop-oldest"; }>; export declare function scanForServices>(manager: BleManager, serviceUuids: readonly Uuid[], options: Omit, 'scan'> & { readonly scan?: Partial['scan']>; }): Promise>; export declare function withDiscoveredConnection, Value>(manager: BleManager, peerId: PeerId, options: PublicOperationOptions, fn: (session: ConnectedGattDatabase) => Promise): Promise; export declare function throwIfCleanupFailed(cleanup: CleanupRecord, operation: string): void; export {}; //# sourceMappingURL=public-helpers.d.ts.map