import type { BoundedAsyncStream } from '../backend-contract/streams.js'; import type { GattAccessRequirements, GattCharacteristicPropertyAvailability, GattDescriptorProperties } from '../backend-contract/gatt.js'; import type { DiscoveredGattDatabaseHandle } from '../manager/consumer-handles.js'; import { type OperationOptions } from './operation-options.js'; import { type StreamPolicy } from './stream-presets.js'; import { type PublicBoundedAsyncStream } from './streams.js'; import { type CleanupRecord } from './cleanup.js'; export type { GattAccessRequirements, GattCharacteristicPropertyAvailability } from '../backend-contract/gatt.js'; export type UuidInput = string | number; export interface OccurrenceSelector { readonly occurrence?: number; } export interface GattPathSelector { readonly serviceOccurrence?: number; readonly characteristicOccurrence?: number; } export interface GattDatabaseChangedEvent { readonly previousGeneration: string; readonly reason: 'service-changed' | 'reconnect' | 'backend-reset' | 'manual-rediscovery'; readonly affectedHandleRange: { readonly start: number; readonly end: number; } | null; } export interface GattServiceReference { readonly uuid: string; readonly occurrence: number; } export interface GattCharacteristicProperties { readonly broadcast: boolean; readonly read: boolean; readonly writeWithResponse: boolean; readonly writeWithoutResponse: boolean; readonly authenticatedSignedWrites: boolean; readonly notify: boolean; readonly indicate: boolean; readonly extendedProperties: boolean; readonly reliableWrite: boolean; readonly writableAuxiliaries: boolean; readonly availability: GattCharacteristicPropertyAvailability; } export interface GattWriteOptions extends OperationOptions { readonly response?: 'required' | 'not-required' | 'automatic'; } export interface LongWriteOptions extends GattWriteOptions { readonly chunkSize?: number; } export interface DescriptorWriteOptions extends OperationOptions { readonly response?: 'required' | 'automatic'; } export interface GattSubscribeOptions extends OperationOptions { readonly delivery?: 'prefer-notification' | 'prefer-indication' | 'require-notification' | 'require-indication'; readonly stream?: StreamPolicy; } export type GattDelivery = 'notification' | 'indication' | 'unknown'; export interface GattValueEvent { readonly value: Uint8Array; readonly delivery: GattDelivery; readonly observedAtMonotonicMs: number; readonly sequence: number; } export type GattValueStream = PublicBoundedAsyncStream; export interface GattDatabaseSnapshot { readonly generation: string; readonly services: readonly GattService[]; readonly characteristics: readonly GattCharacteristic[]; readonly descriptors: readonly GattDescriptor[]; } export interface GattDatabase { readonly generation: string; readonly services: readonly GattService[]; readonly changed: PublicBoundedAsyncStream; service(uuid: UuidInput, selector?: OccurrenceSelector): GattService; servicesByUuid(uuid: UuidInput): readonly GattService[]; characteristic(serviceUuid: UuidInput, characteristicUuid: UuidInput, selector?: GattPathSelector): GattCharacteristic; snapshot(): GattDatabaseSnapshot; } export interface GattService { readonly uuid: string; readonly occurrence: number; readonly primary: boolean; readonly includedServices: readonly GattServiceReference[]; readonly characteristics: readonly GattCharacteristic[]; characteristic(uuid: UuidInput, selector?: OccurrenceSelector): GattCharacteristic; characteristicsByUuid(uuid: UuidInput): readonly GattCharacteristic[]; } export interface GattCharacteristic { readonly uuid: string; readonly occurrence: number; readonly service: GattService; readonly properties: GattCharacteristicProperties; readonly access: GattAccessRequirements; readonly descriptors: readonly GattDescriptor[]; read(options?: OperationOptions): Promise; write(value: Uint8Array, options?: GattWriteOptions): Promise; writeWhenReady(value: Uint8Array, options?: OperationOptions): Promise; writeLong(value: Uint8Array, options?: LongWriteOptions): Promise; subscribe(options?: GattSubscribeOptions): Promise; withSubscription(options: GattSubscribeOptions, action: (subscription: GattSubscription) => Promise): Promise; descriptor(uuid: UuidInput, selector?: OccurrenceSelector): GattDescriptor; } export interface GattDescriptor { readonly uuid: string; readonly occurrence: number; readonly characteristic: GattCharacteristic; readonly properties: GattDescriptorProperties; read(options?: OperationOptions): Promise; write(value: Uint8Array, options?: DescriptorWriteOptions): Promise; } export type GattWriteReceipt = import('../manager/consumer-handles.js').PortableWriteReceipt; export type GattLongWriteReceipt = import('../manager/consumer-handles.js').PortableLongWriteReceipt; export interface GattSubscription { readonly requestedDelivery: GattSubscribeOptions['delivery']; readonly effectiveDelivery: GattDelivery; readonly values: GattValueStream; remove(): Promise; } export interface PublicGattDatabaseSource extends DiscoveredGattDatabaseHandle { readonly changed?: BoundedAsyncStream; assertCurrent?(): void; readonly deliverySelection?: 'controllable' | 'unknown'; } export declare function createPublicGattDatabase(source: PublicGattDatabaseSource): Promise; //# sourceMappingURL=gatt.d.ts.map