/** * @license * Copyright 2022-2026 Matter.js Authors * SPDX-License-Identifier: Apache-2.0 */ import { Bytes, ChannelType, Duration, MaybePromise, ServerAddress } from "@matter/general"; import { CommissionableDevice, CommissionableDeviceIdentifiers, CommissionableDeviceIdentity, Scanner } from "./Scanner.js"; export interface BlePeripheral { readonly address: string; } export interface BleScannerClient { setDiscoveryCallback(callback: (peripheral: BlePeripheral, data: Bytes) => void): void; startScanning(): Promise; stopScanning(): Promise; /** * Whether a peripheral discovered earlier can still be reached. A transport that routes through remote proxies * loses access to a peripheral when the proxy that reported it goes away, and a peripheral it cannot reach is no * candidate for commissioning. A client that omits this keeps every discovered peripheral available; the record * stays either way, so a peripheral becomes a candidate again as soon as it is reachable again. */ isPeripheralReachable?(address: string): boolean; /** * Time this client spent listening, meaning its radio scanned and it reported every advertisement it received. * A record only states that a device went silent when its age is measured in this time. * * A client that reports a peripheral once per scan, or that cannot tell how long its radio scanned, omits this. * Its records then remain candidates while a discovery is pending, and are forgotten {@link RECORD_MAX_AGE} after * the later of their last report and the end of the last discovery. An address the device rotated away from is * dropped after elapsed time. */ readonly listeningTime?: Duration; } export type CommissionableDeviceData = CommissionableDevice & { SD: number; }; export type DiscoveredBleDevice = { deviceData: CommissionableDeviceData; peripheral: BlePeripheral; hasAdditionalAdvertisementData: boolean; }; export declare class BleScanner implements Scanner { #private; readonly type = ChannelType.BLE; constructor(client: BleScannerClient); /** Resolves a peripheral for a channel open, so a record stays resolvable here until it is forgotten. */ getDiscoveredDevice(address: string): DiscoveredBleDevice; /** * Forget the device we commissioned. Its advertisement described a commissioning window that is now closed, so it * must not qualify for a later discovery; a device that advertises again is discovered again. * * A record matching the identity is dropped too. Another device of the same vendor, and product when the identity * names one, sharing the discriminator loses its record until it advertises again. */ forgetCommissionedDevice(addresses: readonly ServerAddress[], identity?: CommissionableDeviceIdentity): void; cancelCommissionableDeviceDiscovery(identifier: CommissionableDeviceIdentifiers, resolvePromise?: boolean): void; findCommissionableDevices(identifier: CommissionableDeviceIdentifiers, timeout?: Duration, ignoreExistingRecords?: boolean): Promise; findCommissionableDevicesContinuously(identifier: CommissionableDeviceIdentifiers, callback: (device: CommissionableDevice) => void, timeout?: Duration, cancelSignal?: Promise): Promise; getDiscoveredCommissionableDevices(identifier: CommissionableDeviceIdentifiers): CommissionableDevice[]; protected closeClient(): MaybePromise; close(): Promise; } //# sourceMappingURL=BleScanner.d.ts.map