import type { BackendAttachment, BackendConnection, BackendEvent, BleCentralBackend, GattBackend, PeerDirectoryBackend, ResourceCounters } from '../backend-contract/backend.js'; import { BackendContractError } from '../backend-contract/errors.js'; import type { BleErrorCode, CleanupRecord } from '../backend-contract/errors.js'; import type { AdapterDescriptor, AttachmentRecord, BackendProvider, HostNeutralBackendIdentity, ProviderDescriptor } from '../backend-contract/identity.js'; import type { CharacteristicPath, DescriptorPath } from '../backend-contract/gatt.js'; import type { PublicOperationOptions, SubscriptionOptions, WritePolicy, WriteReceipt } from '../backend-contract/operations.js'; import type { AdapterId, BackendCompatibilityOffer, Deadline, OwnedBytes, PeerId } from '../backend-contract/primitives.js'; import type { BoundedAsyncStream } from '../backend-contract/streams.js'; import type { ChooserRequest, ChooserSelection, WebChooser } from '../backend-contract/host/web.js'; import type { WebBluetoothBoundary } from './web-bluetooth-boundary.js'; import { WebBackendConnection, WebGattDatabase } from './web-bluetooth-handles.js'; import type { WebConnectionRecord } from './web-bluetooth-handles.js'; interface AbortableOperation { readonly signal: AbortSignal | null; readonly deadline: Deadline | null; } interface WebProviderOptions { readonly boundary: WebBluetoothBoundary; } /** Explicit Web Bluetooth provider. Importing this module never reads DOM globals. */ export declare class WebBluetoothProvider implements BackendProvider> { private readonly options; readonly descriptor: ProviderDescriptor; constructor(options: WebProviderOptions); listAdapters(): Promise[]>; create(selection: { readonly selectedAdapterId: AdapterId; }): Promise; } export declare function createWebBluetoothProvider(boundary: WebBluetoothBoundary): WebBluetoothProvider; export interface WebAuthorizedPeer { readonly peerId: PeerId; readonly browserDeviceId: string; readonly connected: boolean; } /** Contract-v1 Web Bluetooth backend with chooser-limited discovery semantics. */ export declare class WebBluetoothBackend implements BleCentralBackend>, WebChooser { private readonly boundary; readonly features: import("../backend-contract/index.js").FeatureRegistry; readonly adapter: BleCentralBackend>['adapter']; readonly scanner: BleCentralBackend>['scanner']; readonly connections: BleCentralBackend>['connections']; readonly gatt: GattBackend; readonly peers: PeerDirectoryBackend; private readonly backendInstance; private attachmentRecord; private attachmentGeneration; private negotiatedVersions; private attached; private destroyed; private chooserBusy; private nextPeer; private nextConnection; private ingressOrdinal; private destroyResult; private readonly selectedDevices; private readonly peerByBrowserDeviceId; private readonly connectionsByPeer; private readonly retainedConnections; private readonly pendingConnectionsByPeer; private readonly eventStreams; private readonly adapterStreams; private readonly destroyWaiters; private readonly gattRuntime; private removePageLifecycleListener; private removeAvailabilityChangeListener; private availabilityPollTimer; private availabilityEventSilenceTimer; private availabilityChangeObserved; private availabilitySampleGeneration; private appliedAvailabilitySampleGeneration; constructor(boundary: WebBluetoothBoundary, initialAvailability?: boolean); get identity(): HostNeutralBackendIdentity; get attachment(): AttachmentRecord; attach(request: { readonly coreCompatibility: BackendCompatibilityOffer; }): Promise>>; choose(request: ChooserRequest, options: PublicOperationOptions): Promise>; authorizedPeers(options?: PublicOperationOptions): Promise; private peerRecords; private resolveAuthorizedPeer; private toBackendPeerRecord; peerReferenceFor(peerId: string): { readonly backendId: string; readonly browserDeviceId: string; } | null; events(): BoundedAsyncStream>; resourceCounters(): ResourceCounters; destroy(): Promise; disconnectConnection(connection: WebBackendConnection): Promise; disconnectRecord(record: WebConnectionRecord, reason?: 'connection-lost' | 'owner-released'): Promise; private runDisconnectRecord; staleGattError(operation: string): BackendContractError; 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>; private currentAdapterState; private assertBluetoothAvailable; private beginAvailabilitySample; private applyAvailabilitySample; private refreshAttachmentAvailability; private invalidateUnavailableSession; private releaseRetainedSessionResources; private createAttachmentRecord; private watchAdapterState; private ensureAvailabilityObservation; private releaseAvailabilityObservationIfIdle; private stopAvailabilityObservation; private scheduleAvailabilityEventSilenceFallback; private clearAvailabilityEventSilenceTimer; private scheduleAvailabilityPoll; private pollWatchedAvailability; private reconcileWatchedAvailability; private chooseDevice; private rememberSelection; private connect; private compensatePendingConnection; private deletePendingConnectionIfOwned; private invalidateConnectionGenerations; private unbindConnectionRecord; requireConnection(connection: BackendConnection, operation: string): WebConnectionRecord; requireDatabase(path: CharacteristicPath | DescriptorPath, operation: string): WebGattDatabase; runAbortable(record: WebConnectionRecord | null, operation: AbortableOperation, start: () => Promise, fallbackCode: BleErrorCode, domain: 'chooser' | 'connection' | 'gatt', operationName: string, onLateSuccess?: ((result: Result) => Promise | void) | null): Promise; private assertAbortableAdmission; private cancelInFlightOperations; private emitBackendEvent; identifiers(): import("../backend-contract/primitives.js").AttachmentBoundIdFactory; private assertAttached; private assertUsable; private destroyAllResources; } export declare const WEB_BLUETOOTH_ADAPTER_ID: import("../backend-contract/primitives.js").OpaqueId<"adapter", "web-bluetooth">; export {}; //# sourceMappingURL=web-bluetooth-backend.d.ts.map