import type { CleanupRecord } from './errors.js'; import { type AttachmentRecord } from './identity.js'; import type { AttachmentId, BorrowedBytes, ConnectionId, GattDatabaseId, GenerationId, LeaseId, OwnedBytes, PeerId, SubscriptionId, Uuid } from './primitives.js'; import type { PublicOperationOptions, SubscriptionOptions, WriteMode, WritePolicy, WriteReceipt } from './operations.js'; import type { BoundedAsyncStream } from './streams.js'; export type PathValidity = 'current' | 'stale'; 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 DevicePath { readonly attachment: AttachmentRecord; readonly attachmentId: AttachmentId; readonly peerId: PeerId; } export interface ConnectionPath extends DevicePath { readonly connectionId: ConnectionId; readonly ownerLeaseId: LeaseId; readonly connectionGeneration: GenerationId<'connection-generation', Connection>; } export interface DatabasePath extends ConnectionPath { readonly databaseId: GattDatabaseId; readonly databaseGeneration: GenerationId<'database-generation', Database>; } export interface ServicePath extends DatabasePath { readonly serviceUuid: Uuid; readonly serviceOccurrence: GenerationId<'service-occurrence', ServiceScope>; } export interface CharacteristicPath extends ServicePath { readonly characteristicUuid: Uuid; readonly characteristicOccurrence: GenerationId<'characteristic-occurrence', CharacteristicScope>; readonly validity: Validity; } export interface DescriptorPath extends CharacteristicPath { readonly descriptorUuid: Uuid; readonly descriptorOccurrence: GenerationId<'descriptor-occurrence', DescriptorScope>; } export interface Service { readonly path: ServicePath; readonly primary: boolean; readonly includedServices: readonly GattServiceReference[]; } export interface Characteristic { readonly path: CharacteristicPath; readonly properties: CharacteristicProperties; readonly access: GattAccessRequirements; } /** Complete normalized operation metadata captured at GATT discovery time. */ export interface CharacteristicProperties { 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 GattCharacteristicPropertyAvailability { readonly broadcast: 'known' | 'unknown'; readonly read: 'known' | 'unknown'; readonly writeWithResponse: 'known' | 'unknown'; readonly writeWithoutResponse: 'known' | 'unknown'; readonly authenticatedSignedWrites: 'known' | 'unknown'; readonly notify: 'known' | 'unknown'; readonly indicate: 'known' | 'unknown'; readonly extendedProperties: 'known' | 'unknown'; readonly reliableWrite: 'known' | 'unknown'; readonly writableAuxiliaries: 'known' | 'unknown'; } export interface GattAccessRequirements { readonly read: 'none' | 'encrypted' | 'authenticated' | 'authorized' | 'unknown'; readonly write: 'none' | 'encrypted' | 'authenticated' | 'authorized' | 'unknown'; } export interface GattDescriptorProperties { readonly read: boolean; readonly write: boolean; readonly availability: { readonly read: 'known' | 'unknown'; readonly write: 'known' | 'unknown'; }; readonly access: GattAccessRequirements; } export interface GattServiceReference { readonly uuid: Uuid; readonly occurrence: string; } export interface GattCharacteristicPropertyInput { readonly read: boolean; readonly writeWithResponse: boolean; readonly writeWithoutResponse: boolean; readonly notify: boolean; readonly indicate?: boolean; readonly broadcast?: boolean; readonly authenticatedSignedWrites?: boolean; readonly extendedProperties?: boolean; readonly reliableWrite?: boolean; readonly writableAuxiliaries?: boolean; readonly availability?: Partial; } export declare function createGattCharacteristicProperties(input: GattCharacteristicPropertyInput): CharacteristicProperties; export declare function createGattDescriptorProperties(read: boolean, write: boolean, availability: GattDescriptorProperties['availability'], access: GattAccessRequirements): GattDescriptorProperties; export interface Descriptor { readonly path: DescriptorPath; readonly properties: GattDescriptorProperties; } export interface GattDatabaseSnapshot { readonly path: DatabasePath; readonly services: readonly Service[]; readonly characteristics: readonly Characteristic[]; readonly descriptors: readonly Descriptor[]; } export interface GattDatabase { readonly path: DatabasePath; snapshot(): Promise>; read(path: CharacteristicPath, options: PublicOperationOptions): Promise; write(path: CharacteristicPath, value: BorrowedBytes, options: WritePolicy): Promise>; readDescriptor(path: DescriptorPath, options: PublicOperationOptions): Promise; writeDescriptor(path: DescriptorPath, value: BorrowedBytes, options: WritePolicy): Promise>; subscribe(path: CharacteristicPath, options: SubscriptionOptions): Promise>; } /** Current backend observation used by the portable chunking policy. */ export interface MaximumWriteLengthObservation { readonly connectionId: ConnectionId; readonly connectionGeneration: GenerationId<'connection-generation', string>; readonly mode: WriteMode; readonly maximumWriteLength: number; readonly observedAtMonotonicMs: number; } export interface NotificationValue { readonly value: OwnedBytes; readonly indication: boolean; } export interface Subscription { readonly subscriptionId: SubscriptionId; readonly path: CharacteristicPath; readonly values: BoundedAsyncStream; remove(): Promise; } export declare function assertCurrentPath(path: CharacteristicPath): asserts path is CharacteristicPath; export declare function assertPathMatchesAttachment(path: DevicePath, attachment: AttachmentRecord): void; //# sourceMappingURL=gatt.d.ts.map