/** * @license * Copyright 2022-2026 Matter.js Authors * SPDX-License-Identifier: Apache-2.0 */ import type { ClientNode } from "#node/ClientNode.js"; import type { ServerNode } from "#node/ServerNode.js"; import { CancelablePromise, Duration, MaybePromise } from "@matter/general"; import { CommissionableDeviceIdentifiers } from "@matter/protocol"; import { DiscoveryCapabilitiesBitmap, TypeFromPartialBitSchema } from "@matter/types"; /** * Discovery of commissionable devices. * * This is a cancelable promise; use cancel() or the `abort` option to terminate discovery. A cancel, an abort, or * the failure of every scanner interrupts discovery: it stops scanning and rejects with that reason once it has wound * down. The failure of only some scanners is logged and does not interrupt. An interruption after the discovery has * its result, such as a candidate that won PASE, is ignored and the discovery completes with that result. */ export declare abstract class Discovery extends CancelablePromise { #private; constructor(owner: ServerNode, options: Discovery.Options | undefined); get settled(): Promise; protected get owner(): ServerNode; protected abstract onDiscovered(node: ClientNode): void; protected abstract onComplete(): MaybePromise; /** * Terminate discovery. * * This will not abort node initialization but it will terminate any active discoveries. The discovery result will * be the same as if the discovery had timed out. * * To abort the operation due to error use {@link cancel}. */ stop(): void; toString(): string; protected onCancel(reason: Error): void; /** * Called when a cancel, an abort or the failure of every scanner interrupts discovery. Returns `false` if the * discovery already has its result, so the interruption is ignored and the discovery completes normally. */ protected onInterrupt(_reason: Error): boolean; } export declare namespace Discovery { type Options = CommissionableDeviceIdentifiers & { timeout?: Duration; /** * Aborting this signal has the same effect as {@link Discovery#cancel} with the abort reason. */ abort?: AbortSignal; /** * The transports the device is expected to be discoverable on, as an onboarding payload states them. * * IP network discovery participates regardless of the `onIpNetwork` bit; BLE only where the payload names it. * Omitting this discovers on every installed transport, BLE included. * * @see {@link MatterSpecification.v161.Core} ยง 5.1.3.1 Table 60 */ discoveryCapabilities?: TypeFromPartialBitSchema; }; type InstanceOptions = Options & { /** * The local ID to assign the node if newly discovered. This is the stable identifier used for the node's "id" * property. * * By default matter.js assigns an ID of the form "peerN". */ id?: string; }; } //# sourceMappingURL=Discovery.d.ts.map