import type { BackendConnection, BackendSubscription, ConnectionLease, ScanLease } from '../backend-contract/backend'; import type { AdvertisementObservation } from '../backend-contract/advertisement'; import type { CleanupRecord } from '../backend-contract/errors'; import type { Characteristic, CharacteristicPath, DatabasePath, Descriptor, DescriptorPath, GattDatabase, GattDatabaseSnapshot, NotificationValue, Service } from '../backend-contract/gatt'; import { type AttachmentRecord } from '../backend-contract/identity'; import type { OperationTerminalRecord, PublicOperationOptions, SubscriptionOptions, WritePolicy, WriteReceipt } from '../backend-contract/operations'; import type { AttachmentId, ConnectionId, GenerationId, LeaseId, OwnedBytes, PeerId, ScanSessionId, SubscriptionId } from '../backend-contract/primitives'; import type { BoundedAsyncStream } from '../backend-contract/streams'; import type { CoreBoundedStream } from '../core/bounded-stream'; import type { WebBluetoothCharacteristicBoundary, WebBluetoothDescriptorBoundary, WebBluetoothDeviceBoundary, WebBluetoothDisconnectListener, WebBluetoothNotificationListener } from './web-bluetooth-boundary'; export interface WebGattDatabaseHost { readonly identity: { readonly attachment: AttachmentRecord; }; disconnectConnection(connection: WebBackendConnection): Promise; disconnectRecord(record: WebConnectionRecord): Promise; staleGattError(operation: string): Error; readDirect(database: WebGattDatabase, path: CharacteristicPath, options: PublicOperationOptions): Promise; writeDirect(database: WebGattDatabase, path: CharacteristicPath, value: Readonly, options: WritePolicy): Promise>; readDescriptorDirect(database: WebGattDatabase, path: DescriptorPath, options: PublicOperationOptions): Promise; writeDescriptorDirect(database: WebGattDatabase, path: DescriptorPath, value: Readonly, options: WritePolicy): Promise>; subscribeDirect(database: WebGattDatabase, path: CharacteristicPath, options: SubscriptionOptions): Promise>; } export interface WebConnectionRecord { readonly peerId: PeerId; readonly device: WebBluetoothDeviceBoundary; readonly grantedServices: ReadonlySet; readonly connection: WebBackendConnection; readonly leaseId: LeaseId; readonly disconnectListener: WebBluetoothDisconnectListener; readonly disconnectWaiters: Set<() => void>; database: WebGattDatabase | null; valid: boolean; subscriptionReleased: boolean; physicalReleased: boolean; disconnectPromise: Promise | null; } export interface WebPendingConnection { readonly peerId: PeerId; readonly device: WebBluetoothDeviceBoundary; readonly grantedServices: ReadonlySet; readonly ownershipToken: object; nativeConnect: Promise; state: 'connecting' | 'compensating' | 'cleanup-failed'; cleanupFailureReported: boolean; } export interface WebSelectedDevice { readonly peerId: PeerId; readonly device: WebBluetoothDeviceBoundary; readonly grantedServices: ReadonlySet; } export declare class WebScanLease implements ScanLease { readonly scanSessionId: ScanSessionId; readonly leaseId: LeaseId; readonly observations: BoundedAsyncStream>; private readonly stopOperation; readonly shareToken: null; constructor(scanSessionId: ScanSessionId, leaseId: LeaseId, observations: BoundedAsyncStream>, stopOperation: () => Promise); stop(): Promise; } export declare class WebBackendConnection implements BackendConnection { private readonly backend; readonly peerId: PeerId; readonly connectionId: ConnectionId; readonly connectionGeneration: GenerationId<'connection-generation', string>; private connectionState; constructor(backend: WebGattDatabaseHost, peerId: PeerId, connectionId: ConnectionId, connectionGeneration: GenerationId<'connection-generation', string>); get attachment(): AttachmentRecord; get attachmentId(): AttachmentId; get state(): BackendConnection['state']; disconnect(): Promise; transition(state: BackendConnection['state']): void; } export declare class WebConnectionLease implements ConnectionLease { private readonly backend; readonly record: WebConnectionRecord; readonly leaseId: LeaseId; readonly connection: BackendConnection; private releaseResult; constructor(backend: WebGattDatabaseHost, record: WebConnectionRecord, leaseId: LeaseId); release(): Promise; } export declare class WebGattDatabase implements GattDatabase { private readonly backend; readonly record: WebConnectionRecord; readonly path: DatabasePath; private readonly services; private readonly characteristics; private readonly descriptors; readonly characteristicBoundaries: ReadonlyMap; readonly descriptorBoundaries: ReadonlyMap; private valid; constructor(backend: WebGattDatabaseHost, record: WebConnectionRecord, path: DatabasePath, services: readonly Service[], characteristics: readonly Characteristic[], descriptors: readonly Descriptor[], characteristicBoundaries: ReadonlyMap, descriptorBoundaries: ReadonlyMap); snapshot(): Promise>; read(path: CharacteristicPath, options: PublicOperationOptions): Promise; write(path: CharacteristicPath, value: Readonly, options: WritePolicy): Promise>; readDescriptor(path: DescriptorPath, options: PublicOperationOptions): Promise; writeDescriptor(path: DescriptorPath, value: Readonly, options: WritePolicy): Promise>; subscribe(path: CharacteristicPath, options: SubscriptionOptions): Promise>; assertCurrent(operation: string): void; assertPath(path: CharacteristicPath | DescriptorPath, operation: string): void; invalidate(): void; } export interface WebManagedSubscription { readonly subscriptionId: SubscriptionId; readonly path: CharacteristicPath; readonly database: WebGattDatabase; readonly characteristic: WebBluetoothCharacteristicBoundary; readonly listener: WebBluetoothNotificationListener; readonly stream: CoreBoundedStream; readonly terminal: OperationTerminalRecord; state: 'enabling' | 'ready' | 'stopping' | 'cleanup-failed' | 'stopped'; startupSettled: boolean; cleanupFailureReported: boolean; removeResult: Promise | null; terminationCleanup: Promise | null; } export declare class WebBackendSubscription implements BackendSubscription { private readonly managed; constructor(managed: WebManagedSubscription); get subscriptionId(): SubscriptionId; get path(): CharacteristicPath; get terminal(): OperationTerminalRecord; get notifications(): BoundedAsyncStream; isManagedBy(managed: WebManagedSubscription): boolean; } export declare function characteristicKey(path: CharacteristicPath): string; export declare function descriptorKey(path: DescriptorPath): string; //# sourceMappingURL=web-bluetooth-handles.d.ts.map